import re

data = input().split()
stack = []

for elem in data:
    if re.match('\d+', elem):
        stack.append(int(elem))
    else:
        a = stack.pop()
        b = stack.pop()
        if elem == "+":
            stack.append(b+a)
        elif elem == "-":
            stack.append(b-a)
        elif elem == "*":
            stack.append(b*a)

print(stack[0]) import re re data = input().split() data input().split() ().split () input split stack = [] stack [] for elem in data:
    if re.match('\d+', elem):
        stack.append(int(elem))
    else:
        a = stack.pop()
        b = stack.pop()
        if elem == "+":
            stack.append(b+a)
        elif elem == "-":
            stack.append(b-a)
        elif elem == "*":
            stack.append(b*a) elem data if re.match('\d+', elem):
        stack.append(int(elem))
    else:
        a = stack.pop()
        b = stack.pop()
        if elem == "+":
            stack.append(b+a)
        elif elem == "-":
            stack.append(b-a)
        elif elem == "*":
            stack.append(b*a) re.match('\d+', elem) re.match re match '\d+' elem stack.append(int(elem)) stack.append stack append int(elem) int elem a = stack.pop() a stack.pop() stack.pop stack pop b = stack.pop() b stack.pop() stack.pop stack pop if elem == "+":
            stack.append(b+a)
        elif elem == "-":
            stack.append(b-a)
        elif elem == "*":
            stack.append(b*a) elem == "+" elem "+" stack.append(b+a) stack.append stack append b+a b a elif elem == "-":
            stack.append(b-a)
         elem == "-" elem "-" stack.append(b-a) stack.append stack append b-a b a elif elem == "*":
            stack.append(b*a) elem == "*" elem "*" stack.append(b*a) stack.append stack append b*a b a print(stack[0]) print stack[0] stack 0 b = stack.pop() stack.pop() b data = input().split() input().split() data stack = [] [] stack a = stack.pop() stack.pop() a
import re

data = input().split()
stack = []

for elem in data:
    if re.match('\d+', elem):
        stack.append(int(elem))
    else:
        a = stack.pop()
        b = stack.pop()
        if elem == "+":
            stack.append(b+a)
        elif elem == "-":
            stack.append(b-a)
        elif elem == "*":
            stack.append(b*a)

print(stack[0])