i = [i for i in input().split()]


op = ['+', '*', '-']
stack = []

for j in i:
    if j in op:
        r = stack.pop()
        l = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j)
print (stack[0]) i for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() i i = [i for i in input().split()] i [i for i in input().split()] op = ['+', '*', '-'] op ['+', '*', '-'] '+' '*' '-' stack = [] stack [] for j in i:
    if j in op:
        r = stack.pop()
        l = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j) j i if j in op:
        r = stack.pop()
        l = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j) j in op j op r = stack.pop() r stack.pop() stack.pop stack pop l = stack.pop() l stack.pop() stack.pop stack pop stack.append(str(eval(l + j + r))) stack.append stack append str(eval(l + j + r)) str eval(l + j + r) eval l + j + r l + j l j r stack.append(j) stack.append stack append j print (stack[0]) print stack[0] stack 0 i = [i for i in input().split()] [i for i in input().split()] i op = ['+', '*', '-'] ['+', '*', '-'] op stack = [] [] stack r = stack.pop() stack.pop() r l = stack.pop() stack.pop() l
i = [i for i in input().split()]


op = ['+', '*', '-']
stack = []

for j in i:
    if j in op:
        r = stack.pop()
        l = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j)
print (stack[0])