S = list(map(str, input().split()))
count = len(S)
stack = []
for i in range(count):
    if S[i] == "+":
        b = stack.pop()
        a = stack.pop()
        stack.append(a + b)
    elif S[i] == "-":
        b = stack.pop()
        a = stack.pop()
        stack.append(a - b)
    elif S[i] == "*":
        b = stack.pop()
        a = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(S[i]))

print(stack[0]) S = list(map(str, input().split())) S list(map(str, input().split())) list map(str, input().split()) map str input().split() ().split () input split count = len(S) count len(S) len S stack = [] stack [] for i in range(count):
    if S[i] == "+":
        b = stack.pop()
        a = stack.pop()
        stack.append(a + b)
    elif S[i] == "-":
        b = stack.pop()
        a = stack.pop()
        stack.append(a - b)
    elif S[i] == "*":
        b = stack.pop()
        a = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(S[i])) i range(count) range count if S[i] == "+":
        b = stack.pop()
        a = stack.pop()
        stack.append(a + b)
    elif S[i] == "-":
        b = stack.pop()
        a = stack.pop()
        stack.append(a - b)
    elif S[i] == "*":
        b = stack.pop()
        a = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(S[i])) S[i] == "+" S[i] S i "+" b = stack.pop() b stack.pop() stack.pop stack pop a = stack.pop() a stack.pop() stack.pop stack pop stack.append(a + b) stack.append stack append a + b a b elif S[i] == "-":
        b = stack.pop()
        a = stack.pop()
        stack.append(a - b)
     S[i] == "-" S[i] S i "-" b = stack.pop() b stack.pop() stack.pop stack pop a = stack.pop() a stack.pop() stack.pop stack pop stack.append(a - b) stack.append stack append a - b a b elif S[i] == "*":
        b = stack.pop()
        a = stack.pop()
        stack.append(a * b)
     S[i] == "*" S[i] S i "*" b = stack.pop() b stack.pop() stack.pop stack pop a = stack.pop() a stack.pop() stack.pop stack pop stack.append(a * b) stack.append stack append a * b a b stack.append(int(S[i])) stack.append stack append int(S[i]) int S[i] S i print(stack[0]) print stack[0] stack 0 a = stack.pop() stack.pop() a S = list(map(str, input().split())) list(map(str, input().split())) S b = stack.pop() stack.pop() b stack = [] [] stack count = len(S) len(S) count b = stack.pop() stack.pop() b a = stack.pop() stack.pop() a b = stack.pop() stack.pop() b a = stack.pop() stack.pop() a
S = list(map(str, input().split()))
count = len(S)
stack = []
for i in range(count):
    if S[i] == "+":
        b = stack.pop()
        a = stack.pop()
        stack.append(a + b)
    elif S[i] == "-":
        b = stack.pop()
        a = stack.pop()
        stack.append(a - b)
    elif S[i] == "*":
        b = stack.pop()
        a = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(S[i]))

print(stack[0])
