nums = []
oprs = []
loop do
  t = gets.strip
  if t == "="
    break
  elsif t.match /^\d+$/
    nums.push t.to_i
  else
    oprs.push t.to_sym
  end
end

p nums.inject{|a, b| a.method(oprs.shift).call(b) }