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