k = gets.chomp.to_i

def check_seven_multi(k)
  left = 0
  cnt = 0

  k.times do 
    cnt += 1
    left = (left * 10 + 7) % k
    if left == 0
      break
    end
  end

  puts cnt
end


if k.even? || k % 5 == 0
  puts -1
else 
  check_seven_multi(k)
end
