k = int(input())

a = [7%k]

for i in range(1, k):
    a.append((a[i-1]*10+7)%k)

for i in range(k):
    if a[i] == 0:
        print(i+1)
        exit()

print(-1) k = int(input()) k int(input()) int input() input a = [7%k] a [7%k] 7%k 7 k for i in range(1, k):
    a.append((a[i-1]*10+7)%k) i range(1, k) range 1 k a.append((a[i-1]*10+7)%k) a.append a append (a[i-1]*10+7)%k a[i-1]*10+7 a[i-1]*10 a[i-1] a i-1 i 1 10 7 k for i in range(k):
    if a[i] == 0:
        print(i+1)
        exit() i range(k) range k if a[i] == 0:
        print(i+1)
        exit() a[i] == 0 a[i] a i 0 print(i+1) print i+1 i 1 exit() exit print(-1) print -1 k = int(input()) int(input()) k a = [7%k] [7%k] a
k = int(input())

a = [7%k]

for i in range(1, k):
    a.append((a[i-1]*10+7)%k)

for i in range(k):
    if a[i] == 0:
        print(i+1)
        exit()

print(-1)