#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

k = int(input())

t = 7
for i in range(k):
    t = t % k
    if t == 0:
        print(i + 1)
        exit()
    else:
        t = t * 10 + 7
print(-1) k = int(input()) k int(input()) int input() input t = 7 t 7 for i in range(k):
    t = t % k
    if t == 0:
        print(i + 1)
        exit()
    else:
        t = t * 10 + 7 i range(k) range k t = t % k t t % k t k if t == 0:
        print(i + 1)
        exit()
    else:
        t = t * 10 + 7 t == 0 t 0 print(i + 1) print i + 1 i 1 exit() exit t = t * 10 + 7 t t * 10 + 7 t * 10 t 10 7 print(-1) print -1 t = t % k t % k t t = t * 10 + 7 t * 10 + 7 t k = int(input()) int(input()) k t = 7 7 t
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

k = int(input())

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