import time
start=time.time()
k=int(input())
ans=0
x=k
for i in range(10**9):
  while x%10!=7:
    x+=k
    if time.time()-start>=1.9:exit(print(-1))
  x//=10
  if x==0:exit(print(i+1)) import time time start=time.time() start time.time() time.time time time k=int(input()) k int(input()) int input() input ans=0 ans 0 x=k x k for i in range(10**9):
  while x%10!=7:
    x+=k
    if time.time()-start>=1.9:exit(print(-1))
  x//=10
  if x==0:exit(print(i+1)) i range(10**9) range 10**9 10 9 while x%10!=7:
    x+=k
    if time.time()-start>=1.9:exit(print(-1))
   x%10!=7 x%10 x 10 7 x+=k x k if time.time()-start>=1.9:exit(print(-1))
   time.time()-start>=1.9 time.time()-start time.time() time.time time time start 1.9 x//=10 x 10 if x==0:exit(print(i+1 x==0 x 0 x//=10 10 x k=int(input()) int(input()) k x=k k x start=time.time() time.time() start ans=0 0 ans x+=k k x
import time
start=time.time()
k=int(input())
ans=0
x=k
for i in range(10**9):
  while x%10!=7:
    x+=k
    if time.time()-start>=1.9:exit(print(-1))
  x//=10
  if x==0:exit(print(i+1))
