# -*- coding: utf-8 -*-

numbers = list("1234567890")
querry = [n for n in input().split()]

stack = []

for q in querry:
    if q == "+":
        stack.append(stack.pop() + stack.pop())
    elif q == "-":
        stack.append(-stack.pop() + stack.pop())
    elif q == "*":
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(q))

print(stack.pop()) numbers = list("1234567890") numbers list("1234567890") list "1234567890" n for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() n querry = [n for n in input().split()] querry [n for n in input().split()] stack = [] stack [] for q in querry:
    if q == "+":
        stack.append(stack.pop() + stack.pop())
    elif q == "-":
        stack.append(-stack.pop() + stack.pop())
    elif q == "*":
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(q)) q querry if q == "+":
        stack.append(stack.pop() + stack.pop())
    elif q == "-":
        stack.append(-stack.pop() + stack.pop())
    elif q == "*":
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(q)) q == "+" q "+" stack.append(stack.pop() + stack.pop()) stack.append stack append stack.pop() + stack.pop() stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop elif q == "-":
        stack.append(-stack.pop() + stack.pop())
     q == "-" q "-" stack.append(-stack.pop() + stack.pop()) stack.append stack append -stack.pop() + stack.pop() -stack.pop() stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop elif q == "*":
        stack.append(stack.pop() * stack.pop())
     q == "*" q "*" stack.append(stack.pop() * stack.pop()) stack.append stack append stack.pop() * stack.pop() stack.pop() stack.pop stack pop stack.pop() stack.pop stack pop stack.append(int(q)) stack.append stack append int(q) int q print(stack.pop()) print stack.pop() stack.pop stack pop numbers = list("1234567890") list("1234567890") numbers stack = [] [] stack querry = [n for n in input().split()] [n for n in input().split()] querry
# -*- coding: utf-8 -*-

numbers = list("1234567890")
querry = [n for n in input().split()]

stack = []

for q in querry:
    if q == "+":
        stack.append(stack.pop() + stack.pop())
    elif q == "-":
        stack.append(-stack.pop() + stack.pop())
    elif q == "*":
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(q))

print(stack.pop())