import re

data = input().split(' ')
stack = []
for w in data:
    if re.match(r'[0-9]', w):
        stack.append(w)
        # print(stack)
    else:
        r = stack.pop()
        l = stack.pop()
        stack.append(eval(str(l) + w + str(r)))
        # print(stack)

print(stack[0]) import re re data = input().split(' ') data input().split(' ') ().split () input split ' ' stack = [] stack [] for w in data:
    if re.match(r'[0-9]', w):
        stack.append(w)
        # print(stack)
    else:
        r = stack.pop()
        l = stack.pop()
        stack.append(eval(str(l) + w + str(r)))
        # print(stack) w data if re.match(r'[0-9]', w):
        stack.append(w)
        # print(stack)
    else:
        r = stack.pop()
        l = stack.pop()
        stack.append(eval(str(l) + w + str(r)))
        # print(stack) re.match(r'[0-9]', w) re.match re match r'[0-9]' w stack.append(w) stack.append stack append w r = stack.pop() r stack.pop() stack.pop stack pop l = stack.pop() l stack.pop() stack.pop stack pop stack.append(eval(str(l) + w + str(r))) stack.append stack append eval(str(l) + w + str(r)) eval str(l) + w + str(r) str(l) + w str(l) str l w str(r) str r print(stack[0]) print stack[0] stack 0 stack = [] [] stack r = stack.pop() stack.pop() r data = input().split(' ') input().split(' ') data l = stack.pop() stack.pop() l
import re

data = input().split(' ')
stack = []
for w in data:
    if re.match(r'[0-9]', w):
        stack.append(w)
        # print(stack)
    else:
        r = stack.pop()
        l = stack.pop()
        stack.append(eval(str(l) + w + str(r)))
        # print(stack)

print(stack[0])