#coding:utf-8
#1_3_A
formula = input().split()
stack = []
for char in formula:
    if char.isdigit():
        stack.append(char)
    else:
        ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
        stack.append(ans)
print(stack.pop()) formula = input().split() formula input().split() ().split () input split stack = [] stack [] for char in formula:
    if char.isdigit():
        stack.append(char)
    else:
        ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
        stack.append(ans) char formula if char.isdigit():
        stack.append(char)
    else:
        ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
        stack.append(ans) char.isdigit() char.isdigit char isdigit stack.append(char) stack.append stack append char ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop())) ans str(eval(stack.pop(len(stack)-2) + char + stack.pop())) str eval(stack.pop(len(stack)-2) + char + stack.pop()) eval stack.pop(len(stack)-2) + char + stack.pop() stack.pop(len(stack)-2) + char stack.pop(len(stack)-2) stack.pop stack pop len(stack)-2 len(stack) len stack 2 char stack.pop() stack.pop stack pop stack.append(ans) stack.append stack append ans print(stack.pop()) print stack.pop() stack.pop stack pop ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop())) str(eval(stack.pop(len(stack)-2) + char + stack.pop())) ans stack = [] [] stack formula = input().split() input().split() formula
#coding:utf-8
#1_3_A
formula = input().split()
stack = []
for char in formula:
    if char.isdigit():
        stack.append(char)
    else:
        ans = str(eval(stack.pop(len(stack)-2) + char + stack.pop()))
        stack.append(ans)
print(stack.pop())