stack = []
for s in input().split():
    if s.isdigit():
        stack.append(s)
    else:
        y, x = (stack.pop() for _ in range(2))
        stack.append(str(eval(x + s + y)))
print(stack.pop()) stack = [] stack [] for s in input().split():
    if s.isdigit():
        stack.append(s)
    else:
        y, x = (stack.pop() for _ in range(2))
        stack.append(str(eval(x + s + y))) s input().split() ().split () input split if s.isdigit():
        stack.append(s)
    else:
        y, x = (stack.pop() for _ in range(2))
        stack.append(str(eval(x + s + y))) s.isdigit() s.isdigit s isdigit stack.append(s) stack.append stack append s stack.pop() for _ in range(2) for _ in range(2) _ range(2) range 2 for _ in range(2) stack.pop() stack.pop stack pop y, x = (stack.pop() for _ in range(2)) y (stack.pop() for _ in range(2)) x stack.append(str(eval(x + s + y))) stack.append stack append str(eval(x + s + y)) str eval(x + s + y) eval x + s + y x + s x s y print(stack.pop()) print stack.pop() stack.pop stack pop stack = [] [] stack x = (stack.pop() for _ in range(2)) (stack.pop() for _ in range(2)) x y, x = (stack.pop() for _ in range(2)) (stack.pop() for _ in range(2)) y
stack = []
for s in input().split():
    if s.isdigit():
        stack.append(s)
    else:
        y, x = (stack.pop() for _ in range(2))
        stack.append(str(eval(x + s + y)))
print(stack.pop())