# stack
class stack(object):
    def __init__(self):
        self.container = [] # Empty Stack
        self.topIndex = -1
    def push(self, elem):
        self.container.append(elem)
        self.topIndex += 1
    def pop(self):
        if self.topIndex > -1:
            elem = self.container[self.topIndex]
            del self.container[self.topIndex]
            self.topIndex -= 1
            return elem
        else:
            return None

def calc(ins):
    stk = stack()
    try:
        for sin in ins:
            if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
        return stk.pop()
    except:
        print 'Bad Expr'

print calc(raw_input().split(' ')) class stack(object):
    def __init__(self):
        self.container = [] # Empty Stack
        self.topIndex = -1
    def push(self, elem):
        self.container.append(elem)
        self.topIndex += 1
    def pop(self):
        if self.topIndex > -1:
            elem = self.container[self.topIndex]
            del self.container[self.topIndex]
            self.topIndex -= 1
            return elem
        else:
            return None stack def __init__(self):
        self.container = [] # Empty Stack
        self.topIndex = -1
     __init__ self.container = [] self.container self container [] self.topIndex = -1 self.topIndex self topIndex -1 self self def push(self, elem):
        self.container.append(elem)
        self.topIndex += 1
     push self.container.append(elem) self.container.append self.container self container append elem self.topIndex += 1 self.topIndex self topIndex 1 self self elem elem def pop(self):
        if self.topIndex > -1:
            elem = self.container[self.topIndex]
            del self.container[self.topIndex]
            self.topIndex -= 1
            return elem
        else:
            return None pop if self.topIndex > -1:
            elem = self.container[self.topIndex]
            del self.container[self.topIndex]
            self.topIndex -= 1
            return elem
        else:
            return None self.topIndex > -1 self.topIndex self topIndex -1 elem = self.container[self.topIndex] elem self.container[self.topIndex] self.container self container self.topIndex self topIndex del self.container[self.topIndex] self.container[self.topIndex] self.container self container self.topIndex self topIndex self.topIndex -= 1 self.topIndex self topIndex 1 return elem elem return None None self self object def calc(ins):
    stk = stack()
    try:
        for sin in ins:
            if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
        return stk.pop()
    except:
        print 'Bad Expr' calc stk = stack() stk stack() stack try:
        for sin in ins:
            if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
        return stk.pop()
    except:
        print 'Bad Expr' except:
        print 'Bad Expr' print for sin in ins:
            if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
         sin ins if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
         sin == '+' sin '+' stk.push(stk.pop() + stk.pop()) stk.push stk push stk.pop() + stk.pop() stk.pop() stk.pop stk pop stk.pop() stk.pop stk pop elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
             sin == '-' sin '-' a, b = stk.pop(), stk.pop() a stk.pop() stk.pop stk pop b stk.pop() stk.pop stk pop stk.push(b - a) stk.push stk push b - a b a elif sin == '*':
                stk.push(stk.pop() * stk.pop())
             sin == '*' sin '*' stk.push(stk.pop() * stk.pop()) stk.push stk push stk.pop() * stk.pop() stk.pop() stk.pop stk pop stk.pop() stk.pop stk pop elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
             sin == '/' sin '/' a, b = stk.pop(), stk.pop() a stk.pop() stk.pop stk pop b stk.pop() stk.pop stk pop stk.push(b / a) stk.push stk push b / a b a stk.push(int(sin)) stk.push stk push int(sin) int sin return stk.pop() stk.pop() stk.pop stk pop ins ins print calc(raw_input().split(' ')) calc raw_input().split(' ') ().split () raw_input split ' ' def calc(ins):
    stk = stack()
    try:
        for sin in ins:
            if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
        return stk.pop()
    except:
        print 'Bad Expr' def calc(ins):
    stk = stack()
    try:
        for sin in ins:
            if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
        return stk.pop()
    except:
        print 'Bad Expr' calc class stack(object):
    def __init__(self):
        self.container = [] # Empty Stack
        self.topIndex = -1
    def push(self, elem):
        self.container.append(elem)
        self.topIndex += 1
    def pop(self):
        if self.topIndex > -1:
            elem = self.container[self.topIndex]
            del self.container[self.topIndex]
            self.topIndex -= 1
            return elem
        else:
            return None class stack(object):
    def __init__(self):
        self.container = [] # Empty Stack
        self.topIndex = -1
    def push(self, elem):
        self.container.append(elem)
        self.topIndex += 1
    def pop(self):
        if self.topIndex > -1:
            elem = self.container[self.topIndex]
            del self.container[self.topIndex]
            self.topIndex -= 1
            return elem
        else:
            return None stack
# stack
class stack(object):
    def __init__(self):
        self.container = [] # Empty Stack
        self.topIndex = -1
    def push(self, elem):
        self.container.append(elem)
        self.topIndex += 1
    def pop(self):
        if self.topIndex > -1:
            elem = self.container[self.topIndex]
            del self.container[self.topIndex]
            self.topIndex -= 1
            return elem
        else:
            return None

def calc(ins):
    stk = stack()
    try:
        for sin in ins:
            if sin == '+':
                stk.push(stk.pop() + stk.pop())
            elif sin == '-':
                a, b = stk.pop(), stk.pop()
                stk.push(b - a)
            elif sin == '*':
                stk.push(stk.pop() * stk.pop())
            elif sin == '/':
                a, b = stk.pop(), stk.pop()
                stk.push(b / a)
            else:
                stk.push(int(sin))
        return stk.pop()
    except:
        print 'Bad Expr'

print calc(raw_input().split(' '))