A = list(map(str,input().split()))
stack = []
for item in A:
    if item != '+' and item != '-' and item != '*':
        stack.append(str(item))
    elif item == '+':
        v = int(stack[-2]) + int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '-':
        v = int(stack[-2]) - int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '*':
        v = int(stack[-2]) * int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))

print(stack[-1])
 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 item in A:
    if item != '+' and item != '-' and item != '*':
        stack.append(str(item))
    elif item == '+':
        v = int(stack[-2]) + int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '-':
        v = int(stack[-2]) - int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '*':
        v = int(stack[-2]) * int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v)) item A if item != '+' and item != '-' and item != '*':
        stack.append(str(item))
    elif item == '+':
        v = int(stack[-2]) + int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '-':
        v = int(stack[-2]) - int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '*':
        v = int(stack[-2]) * int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v)) item != '+' and item != '-' and item != '*' item != '+' and item != '-' item != '+' item '+' item != '-' item '-' item != '*' item '*' stack.append(str(item)) stack.append stack append str(item) str item elif item == '+':
        v = int(stack[-2]) + int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
     item == '+' item '+' v = int(stack[-2]) + int(stack[-1]) v int(stack[-2]) + int(stack[-1]) int(stack[-2]) int stack[-2] stack -2 int(stack[-1]) int stack[-1] stack -1 del stack[-2] stack[-2] stack -2 del stack[-1] stack[-1] stack -1 stack.append(str(v)) stack.append stack append str(v) str v elif item == '-':
        v = int(stack[-2]) - int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
     item == '-' item '-' v = int(stack[-2]) - int(stack[-1]) v int(stack[-2]) - int(stack[-1]) int(stack[-2]) int stack[-2] stack -2 int(stack[-1]) int stack[-1] stack -1 del stack[-2] stack[-2] stack -2 del stack[-1] stack[-1] stack -1 stack.append(str(v)) stack.append stack append str(v) str v elif item == '*':
        v = int(stack[-2]) * int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v)) item == '*' item '*' v = int(stack[-2]) * int(stack[-1]) v int(stack[-2]) * int(stack[-1]) int(stack[-2]) int stack[-2] stack -2 int(stack[-1]) int stack[-1] stack -1 del stack[-2] stack[-2] stack -2 del stack[-1] stack[-1] stack -1 stack.append(str(v)) stack.append stack append str(v) str v print(stack[-1]) print stack[-1] stack -1 A = list(map(str,input().split())) list(map(str,input().split())) A v = int(stack[-2]) - int(stack[-1]) int(stack[-2]) - int(stack[-1]) v stack = [] [] stack v = int(stack[-2]) + int(stack[-1]) int(stack[-2]) + int(stack[-1]) v v = int(stack[-2]) * int(stack[-1]) int(stack[-2]) * int(stack[-1]) v
A = list(map(str,input().split()))
stack = []
for item in A:
    if item != '+' and item != '-' and item != '*':
        stack.append(str(item))
    elif item == '+':
        v = int(stack[-2]) + int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '-':
        v = int(stack[-2]) - int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))
    elif item == '*':
        v = int(stack[-2]) * int(stack[-1])
        del stack[-2]
        del stack[-1]
        stack.append(str(v))

print(stack[-1])

