(function(input) {
    var p = input.replace(/\n$/, '').split(' ');
    console.log(calc(p));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

function calc(a) {
    if (a.length === 1) {
        return Number(a[0]);
    }
    var op = a.pop();
    var x = a.slice(0, a.length / 2);
    var y = a.slice(a.length / 2);
    x = calc(x);
    y = calc(y);
    //console.log(x + ' ' + op + ' ' + y);
    return eval(x + ' ' + op + ' ' + y);
}