n = int(input())
x = 0
c = True
for i in range(1000000):
    x = ((x *10) +7)%n
    if x == 0:
        print(i+1)
        c = False
        break
        
if c:
    print(-1) n = int(input()) n int(input()) int input() input x = 0 x 0 c = True c True for i in range(1000000):
    x = ((x *10) +7)%n
    if x == 0:
        print(i+1)
        c = False
        break
         i range(1000000) range 1000000 x = ((x *10) +7)%n x ((x *10) +7)%n (x *10) +7 x *10 x 10 7 n if x == 0:
        print(i+1)
        c = False
        break
         x == 0 x 0 print(i+1) print i+1 i 1 c = False c False break if c:
    print(-1) c print(-1) print -1 n = int(input()) int(input()) n x = 0 0 x x = ((x *10) +7)%n ((x *10) +7)%n x c = True True c c = False False c
n = int(input())
x = 0
c = True
for i in range(1000000):
    x = ((x *10) +7)%n
    if x == 0:
        print(i+1)
        c = False
        break
        
if c:
    print(-1)