from collections import deque as D
line, stack = D(input().split()), D()
while line:
    hoge = line.popleft()
    if hoge.isdigit():
        stack.append(hoge)
    else:
        a, b = int(stack.pop()), int(stack.pop())
        if hoge == "*":
            stack.append(a*b)
        elif hoge == "+":
            stack.append(a+b)
        elif hoge == "-":
            stack.append(b-a)
        else:
            stack.append(b//a)
print(stack.popleft()) from collections import deque as D line, stack = D(input().split()), D() line D(input().split()) D input().split() ().split () input split stack D() D while line:
    hoge = line.popleft()
    if hoge.isdigit():
        stack.append(hoge)
    else:
        a, b = int(stack.pop()), int(stack.pop())
        if hoge == "*":
            stack.append(a*b)
        elif hoge == "+":
            stack.append(a+b)
        elif hoge == "-":
            stack.append(b-a)
        else:
            stack.append(b//a) line hoge = line.popleft() hoge line.popleft() line.popleft line popleft if hoge.isdigit():
        stack.append(hoge)
    else:
        a, b = int(stack.pop()), int(stack.pop())
        if hoge == "*":
            stack.append(a*b)
        elif hoge == "+":
            stack.append(a+b)
        elif hoge == "-":
            stack.append(b-a)
        else:
            stack.append(b//a) hoge.isdigit() hoge.isdigit hoge isdigit stack.append(hoge) stack.append stack append hoge a, b = int(stack.pop()), int(stack.pop()) a int(stack.pop()) int stack.pop() stack.pop stack pop b int(stack.pop()) int stack.pop() stack.pop stack pop if hoge == "*":
            stack.append(a*b)
        elif hoge == "+":
            stack.append(a+b)
        elif hoge == "-":
            stack.append(b-a)
        else:
            stack.append(b//a) hoge == "*" hoge "*" stack.append(a*b) stack.append stack append a*b a b elif hoge == "+":
            stack.append(a+b)
         hoge == "+" hoge "+" stack.append(a+b) stack.append stack append a+b a b elif hoge == "-":
            stack.append(b-a)
         hoge == "-" hoge "-" stack.append(b-a) stack.append stack append b-a b a stack.append(b//a) stack.append stack append b//a b a print(stack.popleft()) print stack.popleft() stack.popleft stack popleft stack = D(input().split()), D() D() stack b = int(stack.pop()), int(stack.pop()) int(stack.pop()) b hoge = line.popleft() line.popleft() hoge line, stack = D(input().split()), D() D(input().split()) line a, b = int(stack.pop()), int(stack.pop()) int(stack.pop()) a
from collections import deque as D
line, stack = D(input().split()), D()
while line:
    hoge = line.popleft()
    if hoge.isdigit():
        stack.append(hoge)
    else:
        a, b = int(stack.pop()), int(stack.pop())
        if hoge == "*":
            stack.append(a*b)
        elif hoge == "+":
            stack.append(a+b)
        elif hoge == "-":
            stack.append(b-a)
        else:
            stack.append(b//a)
print(stack.popleft())