k = int(input())

now = 7
cnt = 1
used = [False] * k
ten = 10
while not used[now % k]:
    if now % k == 0:
        print(cnt)
        exit()
    used[now % k] = True
    now = (now + ten * 7) % k
    ten = ten * 10 % k
    cnt += 1
print(-1) k = int(input()) k int(input()) int input() input now = 7 now 7 cnt = 1 cnt 1 used = [False] * k used [False] * k [False] False k ten = 10 ten 10 while not used[now % k]:
    if now % k == 0:
        print(cnt)
        exit()
    used[now % k] = True
    now = (now + ten * 7) % k
    ten = ten * 10 % k
    cnt += 1 not used[now % k] used[now % k] used now % k now k if now % k == 0:
        print(cnt)
        exit()
     now % k == 0 now % k now k 0 print(cnt) print cnt exit() exit used[now % k] = True used[now % k] used now % k now k True now = (now + ten * 7) % k now (now + ten * 7) % k now + ten * 7 now ten * 7 ten 7 k ten = ten * 10 % k ten ten * 10 % k ten * 10 ten 10 k cnt += 1 cnt 1 print(-1) print -1 ten = 10 10 ten now = 7 7 now ten = ten * 10 % k ten * 10 % k ten cnt += 1 1 cnt used = [False] * k [False] * k used now = (now + ten * 7) % k (now + ten * 7) % k now k = int(input()) int(input()) k cnt = 1 1 cnt
k = int(input())

now = 7
cnt = 1
used = [False] * k
ten = 10
while not used[now % k]:
    if now % k == 0:
        print(cnt)
        exit()
    used[now % k] = True
    now = (now + ten * 7) % k
    ten = ten * 10 % k
    cnt += 1
print(-1)
