k = int(input())
i = 0
s = 0
ans = -1

for z in range(k):
    i += 1
    s = 7 + 10*s
    if s % k != 0:
        s = s % k
    else:
        ans = i
        break

print(ans) k = int(input()) k int(input()) int input() input i = 0 i 0 s = 0 s 0 ans = -1 ans -1 for z in range(k):
    i += 1
    s = 7 + 10*s
    if s % k != 0:
        s = s % k
    else:
        ans = i
        break z range(k) range k i += 1 i 1 s = 7 + 10*s s 7 + 10*s 7 10*s 10 s if s % k != 0:
        s = s % k
    else:
        ans = i
        break s % k != 0 s % k s k 0 s = s % k s s % k s k ans = i ans i break print(ans) print ans ans = -1 -1 ans s = 7 + 10*s 7 + 10*s s i = 0 0 i i += 1 1 i s = s % k s % k s ans = i i ans s = 0 0 s k = int(input()) int(input()) k
k = int(input())
i = 0
s = 0
ans = -1

for z in range(k):
    i += 1
    s = 7 + 10*s
    if s % k != 0:
        s = s % k
    else:
        ans = i
        break

print(ans)