
data = input().split()
n = len(data)

stack=[]

for i in data:
    if i == "+":
        x1 = int(stack.pop())
        x2 = int(stack.pop())
        stack.append(x1+x2)
    elif i == "-":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    elif i == "*":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1*x2)
    elif i == "/":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    else:
        stack.append(int(i))
print(stack[0]) data = input().split() data input().split() ().split () input split n = len(data) n len(data) len data stack=[] stack [] for i in data:
    if i == "+":
        x1 = int(stack.pop())
        x2 = int(stack.pop())
        stack.append(x1+x2)
    elif i == "-":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    elif i == "*":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1*x2)
    elif i == "/":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    else:
        stack.append(int(i)) i data if i == "+":
        x1 = int(stack.pop())
        x2 = int(stack.pop())
        stack.append(x1+x2)
    elif i == "-":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    elif i == "*":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1*x2)
    elif i == "/":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    else:
        stack.append(int(i)) i == "+" i "+" x1 = int(stack.pop()) x1 int(stack.pop()) int stack.pop() stack.pop stack pop x2 = int(stack.pop()) x2 int(stack.pop()) int stack.pop() stack.pop stack pop stack.append(x1+x2) stack.append stack append x1+x2 x1 x2 elif i == "-":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
     i == "-" i "-" x2 = int(stack.pop()) x2 int(stack.pop()) int stack.pop() stack.pop stack pop x1 = int(stack.pop()) x1 int(stack.pop()) int stack.pop() stack.pop stack pop stack.append(x1-x2) stack.append stack append x1-x2 x1 x2 elif i == "*":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1*x2)
     i == "*" i "*" x2 = int(stack.pop()) x2 int(stack.pop()) int stack.pop() stack.pop stack pop x1 = int(stack.pop()) x1 int(stack.pop()) int stack.pop() stack.pop stack pop stack.append(x1*x2) stack.append stack append x1*x2 x1 x2 elif i == "/":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
     i == "/" i "/" x2 = int(stack.pop()) x2 int(stack.pop()) int stack.pop() stack.pop stack pop x1 = int(stack.pop()) x1 int(stack.pop()) int stack.pop() stack.pop stack pop stack.append(x1-x2) stack.append stack append x1-x2 x1 x2 stack.append(int(i)) stack.append stack append int(i) int i print(stack[0]) print stack[0] stack 0 data = input().split() input().split() data x2 = int(stack.pop()) int(stack.pop()) x2 n = len(data) len(data) n x1 = int(stack.pop()) int(stack.pop()) x1 x2 = int(stack.pop()) int(stack.pop()) x2 stack=[] [] stack x1 = int(stack.pop()) int(stack.pop()) x1 x1 = int(stack.pop()) int(stack.pop()) x1 x2 = int(stack.pop()) int(stack.pop()) x2 x2 = int(stack.pop()) int(stack.pop()) x2 x1 = int(stack.pop()) int(stack.pop()) x1

data = input().split()
n = len(data)

stack=[]

for i in data:
    if i == "+":
        x1 = int(stack.pop())
        x2 = int(stack.pop())
        stack.append(x1+x2)
    elif i == "-":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    elif i == "*":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1*x2)
    elif i == "/":
        x2 = int(stack.pop())
        x1 = int(stack.pop())
        stack.append(x1-x2)
    else:
        stack.append(int(i))
print(stack[0])