K = int(input())

ans = -1
tmp = 0
for i in range(1, K + 1):
    tmp = (tmp*10%K + 7) % K
    if tmp == 0:
        ans = i
        break

print(ans) K = int(input()) K int(input()) int input() input ans = -1 ans -1 tmp = 0 tmp 0 for i in range(1, K + 1):
    tmp = (tmp*10%K + 7) % K
    if tmp == 0:
        ans = i
        break i range(1, K + 1) range 1 K + 1 K 1 tmp = (tmp*10%K + 7) % K tmp (tmp*10%K + 7) % K tmp*10%K + 7 tmp*10%K tmp*10 tmp 10 K 7 K if tmp == 0:
        ans = i
        break tmp == 0 tmp 0 ans = i ans i break print(ans) print ans K = int(input()) int(input()) K ans = i i ans tmp = 0 0 tmp ans = -1 -1 ans tmp = (tmp*10%K + 7) % K (tmp*10%K + 7) % K tmp
K = int(input())

ans = -1
tmp = 0
for i in range(1, K + 1):
    tmp = (tmp*10%K + 7) % K
    if tmp == 0:
        ans = i
        break

print(ans)