class Stack:
    def __init__(self):
        self.values = []

    def push(self,v):
        self.values.append(v)

    def pop(self):
        if len(self.values) == 0:
            raise
        else:
            v = self.values[len(self.values)-1]
            del self.values[len(self.values)-1]
            return v

symbols = raw_input().split(' ')

stack = Stack()
for s in symbols:
    if not s in ['+', '-', '*']:
        stack.push(s)
    else:
        v1 = int(stack.pop())
        v2 = int(stack.pop())
        if s == '+':
            stack.push(v1+v2)
        elif s == '-':
            stack.push(v2-v1)
        elif s == '*':
            stack.push(v1*v2)

print stack.pop() class Stack:
    def __init__(self):
        self.values = []

    def push(self,v):
        self.values.append(v)

    def pop(self):
        if len(self.values) == 0:
            raise
        else:
            v = self.values[len(self.values)-1]
            del self.values[len(self.values)-1]
            return v Stack def __init__(self):
        self.values = []

     __init__ self.values = [] self.values self values [] self self def push(self,v):
        self.values.append(v)

     push self.values.append(v) self.values.append self.values self values append v self self v v def pop(self):
        if len(self.values) == 0:
            raise
        else:
            v = self.values[len(self.values)-1]
            del self.values[len(self.values)-1]
            return v pop if len(self.values) == 0:
            raise
        else:
            v = self.values[len(self.values)-1]
            del self.values[len(self.values)-1]
            return v len(self.values) == 0 len(self.values) len self.values self values 0 raise v = self.values[len(self.values)-1] v self.values[len(self.values)-1] self.values self values len(self.values)-1 len(self.values) len self.values self values 1 del self.values[len(self.values)-1] self.values[len(self.values)-1] self.values self values len(self.values)-1 len(self.values) len self.values self values 1 return v v self self symbols = raw_input().split(' ') symbols raw_input().split(' ') ().split () raw_input split ' ' stack = Stack() stack Stack() Stack for s in symbols:
    if not s in ['+', '-', '*']:
        stack.push(s)
    else:
        v1 = int(stack.pop())
        v2 = int(stack.pop())
        if s == '+':
            stack.push(v1+v2)
        elif s == '-':
            stack.push(v2-v1)
        elif s == '*':
            stack.push(v1*v2) s symbols if not s in ['+', '-', '*']:
        stack.push(s)
    else:
        v1 = int(stack.pop())
        v2 = int(stack.pop())
        if s == '+':
            stack.push(v1+v2)
        elif s == '-':
            stack.push(v2-v1)
        elif s == '*':
            stack.push(v1*v2) not s in ['+', '-', '*'] s in ['+', '-', '*'] s ['+', '-', '*'] '+' '-' '*' stack.push(s) stack.push stack push s v1 = int(stack.pop()) v1 int(stack.pop()) int stack.pop() stack.pop stack pop v2 = int(stack.pop()) v2 int(stack.pop()) int stack.pop() stack.pop stack pop if s == '+':
            stack.push(v1+v2)
        elif s == '-':
            stack.push(v2-v1)
        elif s == '*':
            stack.push(v1*v2) s == '+' s '+' stack.push(v1+v2) stack.push stack push v1+v2 v1 v2 elif s == '-':
            stack.push(v2-v1)
         s == '-' s '-' stack.push(v2-v1) stack.push stack push v2-v1 v2 v1 elif s == '*':
            stack.push(v1*v2) s == '*' s '*' stack.push(v1*v2) stack.push stack push v1*v2 v1 v2 print stack.pop() stack.pop stack pop stack = Stack() Stack() stack symbols = raw_input().split(' ') raw_input().split(' ') symbols v1 = int(stack.pop()) int(stack.pop()) v1 v2 = int(stack.pop()) int(stack.pop()) v2 class Stack:
    def __init__(self):
        self.values = []

    def push(self,v):
        self.values.append(v)

    def pop(self):
        if len(self.values) == 0:
            raise
        else:
            v = self.values[len(self.values)-1]
            del self.values[len(self.values)-1]
            return v class Stack:
    def __init__(self):
        self.values = []

    def push(self,v):
        self.values.append(v)

    def pop(self):
        if len(self.values) == 0:
            raise
        else:
            v = self.values[len(self.values)-1]
            del self.values[len(self.values)-1]
            return v Stack
class Stack:
    def __init__(self):
        self.values = []

    def push(self,v):
        self.values.append(v)

    def pop(self):
        if len(self.values) == 0:
            raise
        else:
            v = self.values[len(self.values)-1]
            del self.values[len(self.values)-1]
            return v

symbols = raw_input().split(' ')

stack = Stack()
for s in symbols:
    if not s in ['+', '-', '*']:
        stack.push(s)
    else:
        v1 = int(stack.pop())
        v2 = int(stack.pop())
        if s == '+':
            stack.push(v1+v2)
        elif s == '-':
            stack.push(v2-v1)
        elif s == '*':
            stack.push(v1*v2)

print stack.pop()