k = int(input())
cnt = 0
mod = [0]
not_found = 1
while cnt<k+1:
    cnt+=1
    n = mod[-1]*10+7
    mod.append(n%k)
    if n % k == 0:
        not_found = 0
        print(cnt)
        break
if(not_found):
    print(-1) k = int(input()) k int(input()) int input() input cnt = 0 cnt 0 mod = [0] mod [0] 0 not_found = 1 not_found 1 while cnt<k+1:
    cnt+=1
    n = mod[-1]*10+7
    mod.append(n%k)
    if n % k == 0:
        not_found = 0
        print(cnt)
        break cnt<k+1 cnt k+1 k 1 cnt+=1 cnt 1 n = mod[-1]*10+7 n mod[-1]*10+7 mod[-1]*10 mod[-1] mod -1 10 7 mod.append(n%k) mod.append mod append n%k n k if n % k == 0:
        not_found = 0
        print(cnt)
        break n % k == 0 n % k n k 0 not_found = 0 not_found 0 print(cnt) print cnt break if(not_found):
    print(-1) not_found print(-1) print -1 mod = [0] [0] mod not_found = 0 0 not_found cnt+=1 1 cnt n = mod[-1]*10+7 mod[-1]*10+7 n not_found = 1 1 not_found cnt = 0 0 cnt k = int(input()) int(input()) k
k = int(input())
cnt = 0
mod = [0]
not_found = 1
while cnt<k+1:
    cnt+=1
    n = mod[-1]*10+7
    mod.append(n%k)
    if n % k == 0:
        not_found = 0
        print(cnt)
        break
if(not_found):
    print(-1)
