N = int(input())
def resolve():
  a = 7
  for i in range(1,N+1):
    if a % N == 0:
      return i
    a = (a * 10 + 7) % N
  return -1

ans = resolve()
print(ans) N = int(input()) N int(input()) int input() input def resolve():
  a = 7
  for i in range(1,N+1):
    if a % N == 0:
      return i
    a = (a * 10 + 7) % N
  return -1 resolve a = 7 a 7 for i in range(1,N+1):
    if a % N == 0:
      return i
    a = (a * 10 + 7) % N
   i range(1,N+1) range 1 N+1 N 1 if a % N == 0:
      return i
     a % N == 0 a % N a N 0 return i i a = (a * 10 + 7) % N a (a * 10 + 7) % N a * 10 + 7 a * 10 a 10 7 N return -1 -1 ans = resolve() ans resolve() resolve print(ans) print ans ans = resolve() resolve() ans def resolve():
  a = 7
  for i in range(1,N+1):
    if a % N == 0:
      return i
    a = (a * 10 + 7) % N
  return -1 def resolve():
  a = 7
  for i in range(1,N+1):
    if a % N == 0:
      return i
    a = (a * 10 + 7) % N
  return -1 resolve N = int(input()) int(input()) N
N = int(input())
def resolve():
  a = 7
  for i in range(1,N+1):
    if a % N == 0:
      return i
    a = (a * 10 + 7) % N
  return -1

ans = resolve()
print(ans)