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

