K = gets.chomp.to_i
dis = 7
count = 1
while true
  if dis % K == 0
    break
  elsif K % 2 == 0
    break
  else
    dis = dis * 10 + 7
    count += 1
  end
end
if K % 2 == 0
  print -1
elsif
  print count
end
