k = gets.to_i
count = -1
if k%2 == 1
  puts "*" * 90
  max = 1000000
  s = "7"
  while s.to_i <= max
    if s.to_i%k == 0
      count = s.length
      break
    else
      s += "7"
    end
  end
end
print(count)