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