

s = input().split()

stack = []

for i in s:
    if i == '+':
        a = stack.pop()
        b = stack.pop()
        stack.append(a + b)
    elif i == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
    elif i == '*':
        a = stack.pop()
        b = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(i))

print(stack[0]) s = input().split() s input().split() ().split () input split stack = [] stack [] for i in s:
    if i == '+':
        a = stack.pop()
        b = stack.pop()
        stack.append(a + b)
    elif i == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
    elif i == '*':
        a = stack.pop()
        b = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(i)) i s if i == '+':
        a = stack.pop()
        b = stack.pop()
        stack.append(a + b)
    elif i == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
    elif i == '*':
        a = stack.pop()
        b = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(i)) i == '+' i '+' a = stack.pop() a stack.pop() stack.pop stack pop b = stack.pop() b stack.pop() stack.pop stack pop stack.append(a + b) stack.append stack append a + b a b elif i == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
     i == '-' i '-' a = stack.pop() a stack.pop() stack.pop stack pop b = stack.pop() b stack.pop() stack.pop stack pop stack.append(b - a) stack.append stack append b - a b a elif i == '*':
        a = stack.pop()
        b = stack.pop()
        stack.append(a * b)
     i == '*' i '*' a = stack.pop() a stack.pop() stack.pop stack pop b = stack.pop() b stack.pop() stack.pop stack pop stack.append(a * b) stack.append stack append a * b a b stack.append(int(i)) stack.append stack append int(i) int i print(stack[0]) print stack[0] stack 0 b = stack.pop() stack.pop() b b = stack.pop() stack.pop() b a = stack.pop() stack.pop() a b = stack.pop() stack.pop() b stack = [] [] stack s = input().split() input().split() s a = stack.pop() stack.pop() a a = stack.pop() stack.pop() a


s = input().split()

stack = []

for i in s:
    if i == '+':
        a = stack.pop()
        b = stack.pop()
        stack.append(a + b)
    elif i == '-':
        a = stack.pop()
        b = stack.pop()
        stack.append(b - a)
    elif i == '*':
        a = stack.pop()
        b = stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(i))

print(stack[0])