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