'''
Created on 2020/08/22

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  K=int(pin())
  a=7%K
  for i in range(K):
    if a%K==0:
      print(i+1)
      break
    a=(10*a+7)%K
  else:
    print(-1)
  return 
main()

#解説AC '''
Created on 2020/08/22

@author: harurun
''' def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  K=int(pin())
  a=7%K
  for i in range(K):
    if a%K==0:
      print(i+1)
      break
    a=(10*a+7)%K
  else:
    print(-1)
  return  main import sys sys pin=sys.stdin.readline pin sys.stdin.readline sys.stdin sys stdin readline pout=sys.stdout.write pout sys.stdout.write sys.stdout sys stdout write perr=sys.stderr.write perr sys.stderr.write sys.stderr sys stderr write K=int(pin()) K int(pin()) int pin() pin a=7%K a 7%K 7 K for i in range(K):
    if a%K==0:
      print(i+1)
      break
    a=(10*a+7)%K
  else:
    print(-1)
   i range(K) range K if a%K==0:
      print(i+1)
      break
     a%K==0 a%K a K 0 print(i+1) print i+1 i 1 break a=(10*a+7)%K a (10*a+7)%K 10*a+7 10*a 10 a 7 K print(-1) print -1 return main() main def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  K=int(pin())
  a=7%K
  for i in range(K):
    if a%K==0:
      print(i+1)
      break
    a=(10*a+7)%K
  else:
    print(-1)
  return  def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  K=int(pin())
  a=7%K
  for i in range(K):
    if a%K==0:
      print(i+1)
      break
    a=(10*a+7)%K
  else:
    print(-1)
  return  main
'''
Created on 2020/08/22

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  K=int(pin())
  a=7%K
  for i in range(K):
    if a%K==0:
      print(i+1)
      break
    a=(10*a+7)%K
  else:
    print(-1)
  return 
main()

#解説AC