#55381: Solution in Python


evechou270@gmail.com (Chris)


line=input().split() 
stack=[]   #use a stack to track the operation
for x in line:
    if x in ('+', '-', '/', '*'): 
        second=stack.pop() #read the second element in the operation
        first=stack.pop() #read the first element in the operation

#be aware that order matters for subtraction and division, that's why we pop the second element first

      if x=='+':
            stack.append(first+second)
        elif x=='-': 
            stack.append(first-second)
        elif x=='/':
            stack.append(first//second)  #use // for integer division
        elif x=='*':
            stack.append(first*second)
    else:  #now we're sure that x is not an operand
        stack.append(int(x))
print(stack[0]) #the remaining value must be the result