import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


k = I()
ans = -1
a = [0] * (k+1)
a[1] = 7 % k
for i in range(2, k+1):
    a[i] = (a[i-1]*10 + 7) % k

for i in range(1, k+1):
    if a[i] == 0:
        print(i)
        exit()
print(-1) import sys sys def input(): return sys.stdin.readline().strip() input def I(): return int(input()) I def LI(): return list(map(int, input().split())) LI I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I def IR(n): return [I() for i in range(n)] IR n n LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI def LIR(n): return [LI() for i in range(n)] LIR n n S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S def SR(n): return [S() for i in range(n)] SR n n def S(): return input() S def LS(): return input().split() LS INF = float('inf') INF float('inf') float 'inf' k = I() k I() I ans = -1 ans -1 a = [0] * (k+1) a [0] * (k+1) [0] 0 k+1 k 1 a[1] = 7 % k a[1] a 1 7 % k 7 k for i in range(2, k+1):
    a[i] = (a[i-1]*10 + 7) % k i range(2, k+1) range 2 k+1 k 1 a[i] = (a[i-1]*10 + 7) % k a[i] a i (a[i-1]*10 + 7) % k a[i-1]*10 + 7 a[i-1]*10 a[i-1] a i-1 i 1 10 7 k for i in range(1, k+1):
    if a[i] == 0:
        print(i)
        exit() i range(1, k+1) range 1 k+1 k 1 if a[i] == 0:
        print(i)
        exit() a[i] == 0 a[i] a i 0 print(i) print i exit() exit print(-1) print -1 def IR(n): return [I() for i in range(n)] def IR(n): return [I() for i in range(n)] IR a = [0] * (k+1) [0] * (k+1) a def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def SR(n): return [S() for i in range(n)] def SR(n): return [S() for i in range(n)] SR def LS(): return input().split() def LS(): return input().split() LS INF = float('inf') float('inf') INF ans = -1 -1 ans def I(): return int(input()) def I(): return int(input()) I def LIR(n): return [LI() for i in range(n)] def LIR(n): return [LI() for i in range(n)] LIR def S(): return input() def S(): return input() S k = I() I() k
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


k = I()
ans = -1
a = [0] * (k+1)
a[1] = 7 % k
for i in range(2, k+1):
    a[i] = (a[i-1]*10 + 7) % k

for i in range(1, k+1):
    if a[i] == 0:
        print(i)
        exit()
print(-1)
