N=int(input())
num = 7
i=1
a=[]
prir1=1
while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1
if prir1:
    print(-1) N=int(input()) N int(input()) int input() input num = 7 num 7 i=1 i 1 a=[] a [] prir1=1 prir1 1 while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1 i<=N i N xx=num%N xx num%N num N if xx==0:
        print(i)
        prir1=0
        break
     xx==0 xx 0 print(i) print i prir1=0 prir1 0 break num=10*xx+7 num 10*xx+7 10*xx 10 xx 7 i+=1 i 1 if prir1:
    print(-1) prir1 print(-1) print -1 num = 7 7 num prir1=1 1 prir1 i+=1 1 i num=10*xx+7 10*xx+7 num N=int(input()) int(input()) N a=[] [] a i=1 1 i xx=num%N num%N xx prir1=0 0 prir1
N=int(input())
num = 7
i=1
a=[]
prir1=1
while i<=N:
    xx=num%N
    if xx==0:
        print(i)
        prir1=0
        break
    num=10*xx+7
    i+=1
if prir1:
    print(-1)