k=int(input())
a=7
for i in range(k):
    if a%k==0:
        print(i+1)
        exit()
    a=(a*10+7)%k
print(-1) k=int(input()) k int(input()) int input() input a=7 a 7 for i in range(k):
    if a%k==0:
        print(i+1)
        exit()
    a=(a*10+7)%k i range(k) range k if a%k==0:
        print(i+1)
        exit()
     a%k==0 a%k a k 0 print(i+1) print i+1 i 1 exit() exit a=(a*10+7)%k a (a*10+7)%k a*10+7 a*10 a 10 7 k print(-1) print -1 k=int(input()) int(input()) k a=7 7 a a=(a*10+7)%k (a*10+7)%k a
k=int(input())
a=7
for i in range(k):
    if a%k==0:
        print(i+1)
        exit()
    a=(a*10+7)%k
print(-1)