const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const list = input.trim().split(' ');
const OPERATOR = {
  '+': (a, b) => a + b,
  '*': (a, b) => a * b,
  '-': (a, b) => a - b,
  '/': (a, b) => a / b,
};

const stack = [];
list.forEach((value) => {
  if (OPERATOR[value]) {
    const a = stack.pop();
    const b = stack.pop();
    const result = OPERATOR[value](b, a);
    // console.log(a, b, result);
    stack.push(result);
  } else {
    // console.log(value);
    stack.push(value | 0);
  }
});

console.log(stack[0]);

