a = list(map(str,input().split()))
stack = []

for x in a:
    if x == '+':
        stack.append(int(stack.pop()) + int(stack.pop()))
    elif x == '-':
        stack.append(-int(stack.pop()) + int(stack.pop()))
    elif x == '*':
         stack.append(int(stack.pop()) * int(stack.pop()))
    else:
        stack.append(x)
print(int(stack.pop())) a = list(map(str,input().split())) a list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split stack = [] stack [] for x in a:
    if x == '+':
        stack.append(int(stack.pop()) + int(stack.pop()))
    elif x == '-':
        stack.append(-int(stack.pop()) + int(stack.pop()))
    elif x == '*':
         stack.append(int(stack.pop()) * int(stack.pop()))
    else:
        stack.append(x) x a if x == '+':
        stack.append(int(stack.pop()) + int(stack.pop()))
    elif x == '-':
        stack.append(-int(stack.pop()) + int(stack.pop()))
    elif x == '*':
         stack.append(int(stack.pop()) * int(stack.pop()))
    else:
        stack.append(x) x == '+' x '+' stack.append(int(stack.pop()) + int(stack.pop())) stack.append stack append int(stack.pop()) + int(stack.pop()) int(stack.pop()) int stack.pop() stack.pop stack pop int(stack.pop()) int stack.pop() stack.pop stack pop elif x == '-':
        stack.append(-int(stack.pop()) + int(stack.pop()))
     x == '-' x '-' stack.append(-int(stack.pop()) + int(stack.pop())) stack.append stack append -int(stack.pop()) + int(stack.pop()) -int(stack.pop()) int(stack.pop()) int stack.pop() stack.pop stack pop int(stack.pop()) int stack.pop() stack.pop stack pop elif x == '*':
         stack.append(int(stack.pop()) * int(stack.pop()))
     x == '*' x '*' stack.append(int(stack.pop()) * int(stack.pop())) stack.append stack append int(stack.pop()) * int(stack.pop()) int(stack.pop()) int stack.pop() stack.pop stack pop int(stack.pop()) int stack.pop() stack.pop stack pop stack.append(x) stack.append stack append x print(int(stack.pop())) print int(stack.pop()) int stack.pop() stack.pop stack pop a = list(map(str,input().split())) list(map(str,input().split())) a stack = [] [] stack
a = list(map(str,input().split()))
stack = []

for x in a:
    if x == '+':
        stack.append(int(stack.pop()) + int(stack.pop()))
    elif x == '-':
        stack.append(-int(stack.pop()) + int(stack.pop()))
    elif x == '*':
         stack.append(int(stack.pop()) * int(stack.pop()))
    else:
        stack.append(x)
print(int(stack.pop()))
