k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()
cnt, yep = 0, 0
while True:
    yep = (yep * 10 + 7) % k
    cnt += 1
    if yep == 0:
        break
print(cnt) 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 cnt, yep = 0, 0 cnt 0 yep 0 while True:
    yep = (yep * 10 + 7) % k
    cnt += 1
    if yep == 0:
        break True yep = (yep * 10 + 7) % k yep (yep * 10 + 7) % k yep * 10 + 7 yep * 10 yep 10 7 k cnt += 1 cnt 1 if yep == 0:
        break yep == 0 yep 0 break print(cnt) print cnt k = int(input()) int(input()) k yep = 0, 0 0 yep yep = (yep * 10 + 7) % k (yep * 10 + 7) % k yep cnt += 1 1 cnt cnt, yep = 0, 0 0 cnt
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()
cnt, yep = 0, 0
while True:
    yep = (yep * 10 + 7) % k
    cnt += 1
    if yep == 0:
        break
print(cnt)