from sys import stdin
k = int(stdin.readline().rstrip())
num = 7
flag = 0
for i in range(1, k + 1):
    if num % k == 0:
        flag = 1
        break
    num = (num * 10 + 7) % k
if flag == 1:
    print(i)
else:
    print(-1) from sys import stdin k = int(stdin.readline().rstrip()) k int(stdin.readline().rstrip()) int stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip num = 7 num 7 flag = 0 flag 0 for i in range(1, k + 1):
    if num % k == 0:
        flag = 1
        break
    num = (num * 10 + 7) % k i range(1, k + 1) range 1 k + 1 k 1 if num % k == 0:
        flag = 1
        break
     num % k == 0 num % k num k 0 flag = 1 flag 1 break num = (num * 10 + 7) % k num (num * 10 + 7) % k num * 10 + 7 num * 10 num 10 7 k if flag == 1:
    print(i)
else:
    print(-1) flag == 1 flag 1 print(i) print i print(-1) print -1 num = (num * 10 + 7) % k (num * 10 + 7) % k num num = 7 7 num flag = 1 1 flag k = int(stdin.readline().rstrip()) int(stdin.readline().rstrip()) k flag = 0 0 flag
from sys import stdin
k = int(stdin.readline().rstrip())
num = 7
flag = 0
for i in range(1, k + 1):
    if num % k == 0:
        flag = 1
        break
    num = (num * 10 + 7) % k
if flag == 1:
    print(i)
else:
    print(-1)