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

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

print(-1)
