gets; n=gets.split.map(&:to_i) puts [*1..9].zip(n).map{_1*_2}.select{_1.nonzero?}.join("").reverse