mod = int(input())
a = {}
b = int(0)
flag = int(0)
ans = int(0)
for i in range(mod):
  b = b * 10 + 7
  b = b % mod
  if b == 0:
    flag = 1
    ans = int(i) + 1
    break
  else:
    pass

if flag == 1:
  print(ans)
else:
  print("-1") mod = int(input()) mod int(input()) int input() input a = {} a {} b = int(0) b int(0) int 0 flag = int(0) flag int(0) int 0 ans = int(0) ans int(0) int 0 for i in range(mod):
  b = b * 10 + 7
  b = b % mod
  if b == 0:
    flag = 1
    ans = int(i) + 1
    break
  else:
    pass i range(mod) range mod b = b * 10 + 7 b b * 10 + 7 b * 10 b 10 7 b = b % mod b b % mod b mod if b == 0:
    flag = 1
    ans = int(i) + 1
    break
  else:
    pass b == 0 b 0 flag = 1 flag 1 ans = int(i) + 1 ans int(i) + 1 int(i) int i 1 break if flag == 1:
  print(ans)
else:
  print("-1") flag == 1 flag 1 print(ans) print ans print("-1") print "-1" flag = 1 1 flag b = b % mod b % mod b b = b * 10 + 7 b * 10 + 7 b flag = int(0) int(0) flag mod = int(input()) int(input()) mod a = {} {} a ans = int(i) + 1 int(i) + 1 ans b = int(0) int(0) b ans = int(0) int(0) ans
mod = int(input())
a = {}
b = int(0)
flag = int(0)
ans = int(0)
for i in range(mod):
  b = b * 10 + 7
  b = b % mod
  if b == 0:
    flag = 1
    ans = int(i) + 1
    break
  else:
    pass

if flag == 1:
  print(ans)
else:
  print("-1")