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