k=int(input())
s=7
i=1
while s%k!=0:
  i+=1
  s=10*(s%k)+7
  if i==k+1:
    break
else:
  print(i)
  exit()
print(-1) k=int(input()) k int(input()) int input() input s=7 s 7 i=1 i 1 while s%k!=0:
  i+=1
  s=10*(s%k)+7
  if i==k+1:
    break
else:
  print(i)
  exit() s%k!=0 s%k s k 0 i+=1 i 1 s=10*(s%k)+7 s 10*(s%k)+7 10*(s%k) 10 s%k s k 7 if i==k+1:
    break i==k+1 i k+1 k 1 break print(i) print i exit() exit print(-1) print -1 i+=1 1 i k=int(input()) int(input()) k s=10*(s%k)+7 10*(s%k)+7 s i=1 1 i s=7 7 s
k=int(input())
s=7
i=1
while s%k!=0:
  i+=1
  s=10*(s%k)+7
  if i==k+1:
    break
else:
  print(i)
  exit()
print(-1)