K = int(input())
INF = 10**18

a = [INF] * (K+1)
a[0] = 0

for n in range(1, K+1):
    a[n] = (10 * a[n-1] + 7) % K
    if a[n] == 0:
        print(n)
        break
else:
    print(-1) K = int(input()) K int(input()) int input() input INF = 10**18 INF 10**18 10 18 a = [INF] * (K+1) a [INF] * (K+1) [INF] INF K+1 K 1 a[0] = 0 a[0] a 0 0 for n in range(1, K+1):
    a[n] = (10 * a[n-1] + 7) % K
    if a[n] == 0:
        print(n)
        break
else:
    print(-1) n range(1, K+1) range 1 K+1 K 1 a[n] = (10 * a[n-1] + 7) % K a[n] a n (10 * a[n-1] + 7) % K 10 * a[n-1] + 7 10 * a[n-1] 10 a[n-1] a n-1 n 1 7 K if a[n] == 0:
        print(n)
        break a[n] == 0 a[n] a n 0 print(n) print n break print(-1) print -1 K = int(input()) int(input()) K INF = 10**18 10**18 INF a = [INF] * (K+1) [INF] * (K+1) a
K = int(input())
INF = 10**18

a = [INF] * (K+1)
a[0] = 0

for n in range(1, K+1):
    a[n] = (10 * a[n-1] + 7) % K
    if a[n] == 0:
        print(n)
        break
else:
    print(-1)
