k=int(input())
a=0
cnt=-1
for i in range(1,k+1):
  a=(10*a+7)%k
  if a==0:
    cnt=i
    break
print(cnt) k=int(input()) k int(input()) int input() input a=0 a 0 cnt=-1 cnt -1 for i in range(1,k+1):
  a=(10*a+7)%k
  if a==0:
    cnt=i
    break i range(1,k+1) range 1 k+1 k 1 a=(10*a+7)%k a (10*a+7)%k 10*a+7 10*a 10 a 7 k if a==0:
    cnt=i
    break a==0 a 0 cnt=i cnt i break print(cnt) print cnt cnt=-1 -1 cnt k=int(input()) int(input()) k a=(10*a+7)%k (10*a+7)%k a cnt=i i cnt a=0 0 a
k=int(input())
a=0
cnt=-1
for i in range(1,k+1):
  a=(10*a+7)%k
  if a==0:
    cnt=i
    break
print(cnt)