k = int(input())
x = 7%k
s = set()
#i = 1
#while len(s) == 0:
for i in range(1, k+1):
  if x == 0:
    print(i)
    exit()
  #s.add(x)
  x = (x*10+7)%k
  #i += 1
print(-1) k = int(input()) k int(input()) int input() input x = 7%k x 7%k 7 k s = set() s set() set for i in range(1, k+1):
  if x == 0:
    print(i)
    exit()
  #s.add(x)
  x = (x*10+7)%k
  #i += 1 i range(1, k+1) range 1 k+1 k 1 if x == 0:
    print(i)
    exit()
  #s.add(x)
   x == 0 x 0 print(i) print i exit() exit x = (x*10+7)%k x (x*10+7)%k x*10+7 x*10 x 10 7 k print(-1) print -1 x = 7%k 7%k x k = int(input()) int(input()) k s = set() set() s x = (x*10+7)%k (x*10+7)%k x
k = int(input())
x = 7%k
s = set()
#i = 1
#while len(s) == 0:
for i in range(1, k+1):
  if x == 0:
    print(i)
    exit()
  #s.add(x)
  x = (x*10+7)%k
  #i += 1
print(-1)
