ts = input().split(" ")
stack = []
for t in ts:
    if t not in ("-", "+", "*"):
        stack.append(int(t))
    else:
        n2 = stack.pop()
        n1 = stack.pop()
        if t == "-":
            stack.append(n1 - n2)
        elif t == "+":
            stack.append(n1 + n2)
        else:
            stack.append(n1 * n2)
print(stack.pop()) ts = input().split(" ") ts input().split(" ") ().split () input split " " stack = [] stack [] for t in ts:
    if t not in ("-", "+", "*"):
        stack.append(int(t))
    else:
        n2 = stack.pop()
        n1 = stack.pop()
        if t == "-":
            stack.append(n1 - n2)
        elif t == "+":
            stack.append(n1 + n2)
        else:
            stack.append(n1 * n2) t ts if t not in ("-", "+", "*"):
        stack.append(int(t))
    else:
        n2 = stack.pop()
        n1 = stack.pop()
        if t == "-":
            stack.append(n1 - n2)
        elif t == "+":
            stack.append(n1 + n2)
        else:
            stack.append(n1 * n2) t not in ("-", "+", "*") t ("-", "+", "*") "-" "+" "*" stack.append(int(t)) stack.append stack append int(t) int t n2 = stack.pop() n2 stack.pop() stack.pop stack pop n1 = stack.pop() n1 stack.pop() stack.pop stack pop if t == "-":
            stack.append(n1 - n2)
        elif t == "+":
            stack.append(n1 + n2)
        else:
            stack.append(n1 * n2) t == "-" t "-" stack.append(n1 - n2) stack.append stack append n1 - n2 n1 n2 elif t == "+":
            stack.append(n1 + n2)
         t == "+" t "+" stack.append(n1 + n2) stack.append stack append n1 + n2 n1 n2 stack.append(n1 * n2) stack.append stack append n1 * n2 n1 n2 print(stack.pop()) print stack.pop() stack.pop stack pop ts = input().split(" ") input().split(" ") ts n1 = stack.pop() stack.pop() n1 stack = [] [] stack n2 = stack.pop() stack.pop() n2
ts = input().split(" ")
stack = []
for t in ts:
    if t not in ("-", "+", "*"):
        stack.append(int(t))
    else:
        n2 = stack.pop()
        n1 = stack.pop()
        if t == "-":
            stack.append(n1 - n2)
        elif t == "+":
            stack.append(n1 + n2)
        else:
            stack.append(n1 * n2)
print(stack.pop())