var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var tokens = input.split(' ');
var stack = [];

tokens.forEach(function(token) {
	if (token - 0 == token) {
		stack.push(token);
	} else {
		var a = stack.pop();
		var b = stack.pop();
		stack.push(eval(b + token + a));
	}
});

console.log(stack.pop());