#include <iostream>
#include <stack>
using namespace std;
/*
int parse(string input)
{
while(input.find('(')!=string::npos)
{
int start;
int len;
start = input.find('(');
stack<char> brackets;
brackets.push('(');
for(int i=start+1;i<input.length()+1;i++)
{
if (input[i]=='(') brackets.push('(');
if (input[i]==')') brackets.pop();
if (brackets.empty()) { len = start-i; break; }
}
string inbrackets;
input.copy(inbrackets,start+1,len-1);
input.replace(start,len,atoi(parse(inbrackets)));
}
}*/
struct oper
{
int priority;
char type;
};
struct op
{
int type;
int val;
}
int count(string input)
{
stack<op> operands;
stack<oper> operations;
int pos = 0;
while (pos<input.length())
{
int op =0;
while (isdigit(input[pos]))
{
op*=10;
op+=input[pos++]-48;
}
operands.push(op);
if (pos<input.length())
{
operations.push(input[pos++]);
}
}
int res=0;
//while (!operands.empty()) { cout<<operands.top() << " "; operands.pop(); }
//cout << endl;
//while (!operations.empty()) { cout<<operations.top() << " "; operations.pop(); }
while (!operations.empty())
{
char op = operations.top();
operations.pop();
int op1=operands.top();
operands.pop();
int op2=operands.top();
operands.pop();
switch(op)
{
case '+':
operands.push(op1+op2);
break;
case '-':
operands.push(op1-op2);
break;
case '*':
operands.push(op1*op2);
break;
}
}
return operands.top();
}
int main()
{
string input;
while (getline(cin,input))
{
cout << count(input) << endl;
}
}