N = gets.chomp a, b = "", "" N.chars do |c| if c == ?7 a << ?3 b << ?4 else a << c b << ?0 if b.size > 0 end end puts [a, b].join ' '