k=int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    i=1
    t=7
    while t%k!=0:
        i+=1
        t=(t*10+7)%k
    print(i) k=int(input()) k int(input()) int input() input if k%2==0 or k%5==0:
    print(-1)
else:
    i=1
    t=7
    while t%k!=0:
        i+=1
        t=(t*10+7)%k
    print(i) k%2==0 or k%5==0 k%2==0 k%2 k 2 0 k%5==0 k%5 k 5 0 print(-1) print -1 i=1 i 1 t=7 t 7 while t%k!=0:
        i+=1
        t=(t*10+7)%k
     t%k!=0 t%k t k 0 i+=1 i 1 t=(t*10+7)%k t (t*10+7)%k t*10+7 t*10 t 10 7 k print(i) print i k=int(input()) int(input()) k t=(t*10+7)%k (t*10+7)%k t i+=1 1 i t=7 7 t i=1 1 i
k=int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    i=1
    t=7
    while t%k!=0:
        i+=1
        t=(t*10+7)%k
    print(i)