values = gets.split
stack = []
values.each do |v|
  if v =~ /^[0-9]+$/
    stack << v.to_i
    next
  end

  v1 = stack.pop
  v2 = stack.pop
  stack << eval("#{v2} #{v} #{v1}") if ['+', '-', '*', '/'].include?(v)
end

puts stack.pop