K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i) K = int(input()) K int(input()) int input() input if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit() K % 2 == 0 or K % 5 == 0 K % 2 == 0 K % 2 K 2 0 K % 5 == 0 K % 5 K 5 0 print(-1) print -1 exit() exit i = 0 i 0 ai = 0 ai 0 while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break True ai = (ai * 10 + 7) % K ai (ai * 10 + 7) % K ai * 10 + 7 ai * 10 ai 10 7 K i += 1 i 1 if ai == 0:
        break ai == 0 ai 0 break print(i) print i i += 1 1 i i = 0 0 i K = int(input()) int(input()) K ai = 0 0 ai ai = (ai * 10 + 7) % K (ai * 10 + 7) % K ai
K = int(input())

if K % 2 == 0 or K % 5 == 0:
    print(-1)
    exit()

i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % K
    i += 1
    if ai == 0:
        break
print(i)