k = int(input())

maxV = (10**6)**2

i = 0
sevens = 0
while i < 10**6+1:
    sevens = sevens * 10 + 7
    sevens = sevens % k
    i+=1
    if sevens % k == 0:
        print(i)
        exit()

print(-1) k = int(input()) k int(input()) int input() input maxV = (10**6)**2 maxV (10**6)**2 10**6 10 6 2 i = 0 i 0 sevens = 0 sevens 0 while i < 10**6+1:
    sevens = sevens * 10 + 7
    sevens = sevens % k
    i+=1
    if sevens % k == 0:
        print(i)
        exit() i < 10**6+1 i 10**6+1 10**6 10 6 1 sevens = sevens * 10 + 7 sevens sevens * 10 + 7 sevens * 10 sevens 10 7 sevens = sevens % k sevens sevens % k sevens k i+=1 i 1 if sevens % k == 0:
        print(i)
        exit() sevens % k == 0 sevens % k sevens k 0 print(i) print i exit() exit print(-1) print -1 sevens = 0 0 sevens i+=1 1 i i = 0 0 i sevens = sevens * 10 + 7 sevens * 10 + 7 sevens maxV = (10**6)**2 (10**6)**2 maxV k = int(input()) int(input()) k sevens = sevens % k sevens % k sevens
k = int(input())

maxV = (10**6)**2

i = 0
sevens = 0
while i < 10**6+1:
    sevens = sevens * 10 + 7
    sevens = sevens % k
    i+=1
    if sevens % k == 0:
        print(i)
        exit()

print(-1)