k = gets.to_i
if k % 2 == 0 || k % 5 == 0
  puts "-1"
  return
end

mod = 7
pmod = 7
for i in 1..k+1
  if mod%k == 0
    puts i
    return
  end
  mod += pmod * 10
  mod %= k
  pmod *= 10
  pmod %= k
end

puts "-1"