k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
elif k == 1 or k == 7:
    print(1)
else:
    t = 2
    ex = 77
    for i in range(10 ** 8):
        if ex % k == 0:
            break
        ex = (ex % k) * 10 + 7
        t += 1
    print(t) k = int(input()) k int(input()) int input() input if k % 2 == 0 or k % 5 == 0:
    print(-1)
elif k == 1 or k == 7:
    print(1)
else:
    t = 2
    ex = 77
    for i in range(10 ** 8):
        if ex % k == 0:
            break
        ex = (ex % k) * 10 + 7
        t += 1
    print(t) k % 2 == 0 or k % 5 == 0 k % 2 == 0 k % 2 k 2 0 k % 5 == 0 k % 5 k 5 0 print(-1) print -1 elif k == 1 or k == 7:
    print(1) k == 1 or k == 7 k == 1 k 1 k == 7 k 7 print(1) print 1 t = 2 t 2 ex = 77 ex 77 for i in range(10 ** 8):
        if ex % k == 0:
            break
        ex = (ex % k) * 10 + 7
        t += 1
     i range(10 ** 8) range 10 ** 8 10 8 if ex % k == 0:
            break
         ex % k == 0 ex % k ex k 0 break ex = (ex % k) * 10 + 7 ex (ex % k) * 10 + 7 (ex % k) * 10 ex % k ex k 10 7 t += 1 t 1 print(t) print t k = int(input()) int(input()) k t += 1 1 t ex = (ex % k) * 10 + 7 (ex % k) * 10 + 7 ex ex = 77 77 ex t = 2 2 t
k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
elif k == 1 or k == 7:
    print(1)
else:
    t = 2
    ex = 77
    for i in range(10 ** 8):
        if ex % k == 0:
            break
        ex = (ex % k) * 10 + 7
        t += 1
    print(t)