def main():
  K = int(input())
  ans = False
  if K % 2 == 0:
    print(-1)
    exit()
  cnt = 7 % K
  for i in range(1, K+1):
    if cnt == 0:
      ans = True
      print(i)
      exit()
    cnt = (10 * cnt + 7) % K
  if ans == False:
    print(-1)
    exit()
main() def main():
  K = int(input())
  ans = False
  if K % 2 == 0:
    print(-1)
    exit()
  cnt = 7 % K
  for i in range(1, K+1):
    if cnt == 0:
      ans = True
      print(i)
      exit()
    cnt = (10 * cnt + 7) % K
  if ans == False:
    print(-1)
    exit() main K = int(input()) K int(input()) int input() input ans = False ans False if K % 2 == 0:
    print(-1)
    exit()
   K % 2 == 0 K % 2 K 2 0 print(-1) print -1 exit() exit cnt = 7 % K cnt 7 % K 7 K for i in range(1, K+1):
    if cnt == 0:
      ans = True
      print(i)
      exit()
    cnt = (10 * cnt + 7) % K
   i range(1, K+1) range 1 K+1 K 1 if cnt == 0:
      ans = True
      print(i)
      exit()
     cnt == 0 cnt 0 ans = True ans True print(i) print i exit() exit cnt = (10 * cnt + 7) % K cnt (10 * cnt + 7) % K 10 * cnt + 7 10 * cnt 10 cnt 7 K if ans == False:
    print(-1)
    exit() ans == False ans False print(-1) print -1 exit() exit main() main def main():
  K = int(input())
  ans = False
  if K % 2 == 0:
    print(-1)
    exit()
  cnt = 7 % K
  for i in range(1, K+1):
    if cnt == 0:
      ans = True
      print(i)
      exit()
    cnt = (10 * cnt + 7) % K
  if ans == False:
    print(-1)
    exit() def main():
  K = int(input())
  ans = False
  if K % 2 == 0:
    print(-1)
    exit()
  cnt = 7 % K
  for i in range(1, K+1):
    if cnt == 0:
      ans = True
      print(i)
      exit()
    cnt = (10 * cnt + 7) % K
  if ans == False:
    print(-1)
    exit() main
def main():
  K = int(input())
  ans = False
  if K % 2 == 0:
    print(-1)
    exit()
  cnt = 7 % K
  for i in range(1, K+1):
    if cnt == 0:
      ans = True
      print(i)
      exit()
    cnt = (10 * cnt + 7) % K
  if ans == False:
    print(-1)
    exit()
main()