n = int(input()) 
curr = 0
for i in range(1,1000000):
  curr = curr * 10 + 7
  curr = curr % n

  if curr == 0:
    print(i)
    exit()
print(-1) n = int(input()) n int(input()) int input() input curr = 0 curr 0 for i in range(1,1000000):
  curr = curr * 10 + 7
  curr = curr % n

  if curr == 0:
    print(i)
    exit() i range(1,1000000) range 1 1000000 curr = curr * 10 + 7 curr curr * 10 + 7 curr * 10 curr 10 7 curr = curr % n curr curr % n curr n if curr == 0:
    print(i)
    exit() curr == 0 curr 0 print(i) print i exit() exit print(-1) print -1 n = int(input()) int(input()) n curr = 0 0 curr curr = curr % n curr % n curr curr = curr * 10 + 7 curr * 10 + 7 curr
n = int(input()) 
curr = 0
for i in range(1,1000000):
  curr = curr * 10 + 7
  curr = curr % n

  if curr == 0:
    print(i)
    exit()
print(-1)