k = int(input())

a = [7 % k]
if a[0] == 0:
    print(1)
    exit()
for i in range(1, k):
    a.append((10*a[i - 1] + 7) % k)
    if a[i] % k == 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 if a[0] == 0:
    print(1)
    exit() a[0] == 0 a[0] a 0 0 print(1) print 1 exit() exit for i in range(1, k):
    a.append((10*a[i - 1] + 7) % k)
    if a[i] % k == 0:
        print(i + 1)
        exit() i range(1, k) range 1 k a.append((10*a[i - 1] + 7) % k) a.append a append (10*a[i - 1] + 7) % k 10*a[i - 1] + 7 10*a[i - 1] 10 a[i - 1] a i - 1 i 1 7 k if a[i] % k == 0:
        print(i + 1)
        exit() a[i] % k == 0 a[i] % k a[i] a i k 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]
if a[0] == 0:
    print(1)
    exit()
for i in range(1, k):
    a.append((10*a[i - 1] + 7) % k)
    if a[i] % k == 0:
        print(i + 1)
        exit()

print(-1)