var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(' ');

function canCalc(a, b, notation) {
  a = parseInt(a);
  b = parseInt(b);
  if (isNaN(a) || isNaN(b)) {
    return false;
  }
  if (isNaN(parseInt(notation))) {
    return true;
  }
  return false;
}

function calc(a, b, notation) {
  a = parseInt(a);
  b = parseInt(b);
  switch (notation) {
    case '+':
      return a + b;
    case '-':
      return a - b;
    case '*':
      return a * b;
  }
}

function perform(input) {
  if (input.length === 1) {
    console.log(input[0]);
    return;
  }

  var ngInput = [];
  for (var i = 0; i < input.length; i += 3) {
    var a = input[i];
    var b = input[i + 1];
    var notation = input[i + 2];

    if (canCalc(a, b, notation)) {
      ngInput.push(calc(a, b, notation));
    } else {
      if (typeof a !== 'undefined') ngInput.push(a);
      if (typeof b !== 'undefined') ngInput.push(b);
      if (typeof notation !== 'undefined') ngInput.push(notation);
    }
  }
  perform(ngInput);
}

perform(input);