k = int(input())
value = 7

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

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