k = int(input())

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

if 7 % k == 0:
    print(1)
else:
    a = []
    a.append(7 % k)
    t = 0
    for i in range(2, k+1):
        x = (10 * a[i - 2] + 7) % k
        if x == 0:
            print(i)
            break
        else:
            a.append(x)
            t += 1
    if t == k - 1:
        print(-1)
