s = input().split()
stack = []
for v in s:
    # print("v", v)
    # print("stack", stack)
    if v in ["+", "-", "*"]:
        v1 = stack.pop()
        v2 = stack.pop()
        statement = v2 + v + v1
        r = eval(statement)
        stack.append(str(r))
    else:
        stack.append(v)

assert len(stack) == 1
print(stack[0]) s = input().split() s input().split() ().split () input split stack = [] stack [] for v in s:
    # print("v", v)
    # print("stack", stack)
    if v in ["+", "-", "*"]:
        v1 = stack.pop()
        v2 = stack.pop()
        statement = v2 + v + v1
        r = eval(statement)
        stack.append(str(r))
    else:
        stack.append(v) v s if v in ["+", "-", "*"]:
        v1 = stack.pop()
        v2 = stack.pop()
        statement = v2 + v + v1
        r = eval(statement)
        stack.append(str(r))
    else:
        stack.append(v) v in ["+", "-", "*"] v ["+", "-", "*"] "+" "-" "*" v1 = stack.pop() v1 stack.pop() stack.pop stack pop v2 = stack.pop() v2 stack.pop() stack.pop stack pop statement = v2 + v + v1 statement v2 + v + v1 v2 + v v2 v v1 r = eval(statement) r eval(statement) eval statement stack.append(str(r)) stack.append stack append str(r) str r stack.append(v) stack.append stack append v assert len(stack) == 1 len(stack) == 1 len(stack) len stack 1 print(stack[0]) print stack[0] stack 0 s = input().split() input().split() s v2 = stack.pop() stack.pop() v2 stack = [] [] stack statement = v2 + v + v1 v2 + v + v1 statement r = eval(statement) eval(statement) r v1 = stack.pop() stack.pop() v1
s = input().split()
stack = []
for v in s:
    # print("v", v)
    # print("stack", stack)
    if v in ["+", "-", "*"]:
        v1 = stack.pop()
        v2 = stack.pop()
        statement = v2 + v + v1
        r = eval(statement)
        stack.append(str(r))
    else:
        stack.append(v)

assert len(stack) == 1
print(stack[0])
