K = int(input())
s = 7
flg = False
cnt = 0

for i in range(K+1):
    cnt += 1
    if s % K == 0:
        flg = True
        break
    s *= 10
    s %= K
    s += 7

if flg:
    print(cnt)
else:
    print(-1) K = int(input()) K int(input()) int input() input s = 7 s 7 flg = False flg False cnt = 0 cnt 0 for i in range(K+1):
    cnt += 1
    if s % K == 0:
        flg = True
        break
    s *= 10
    s %= K
    s += 7 i range(K+1) range K+1 K 1 cnt += 1 cnt 1 if s % K == 0:
        flg = True
        break
     s % K == 0 s % K s K 0 flg = True flg True break s *= 10 s 10 s %= K s K s += 7 s 7 if flg:
    print(cnt)
else:
    print(-1) flg print(cnt) print cnt print(-1) print -1 cnt += 1 1 cnt flg = False False flg cnt = 0 0 cnt K = int(input()) int(input()) K s += 7 7 s s *= 10 10 s s = 7 7 s s %= K K s flg = True True flg
K = int(input())
s = 7
flg = False
cnt = 0

for i in range(K+1):
    cnt += 1
    if s % K == 0:
        flg = True
        break
    s *= 10
    s %= K
    s += 7

if flg:
    print(cnt)
else:
    print(-1)
