k=gets.to_i
if k%2==0 || k%5==0
  puts -1
elsif k%7==0
  for i in 1..10**6
    if (10**i)%(9*k/7)==1
      maru=1
      break
    end
  end
  puts i

else
  for i in 1..10**6
    if 7*(10**i)%(9*k)==1
      maru=1
      break
    end
  end
  puts i
end
