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