#include <iostream>
#include <string>
#include <stack>
#include <map>
using namespace std;
int priority(string c)
{
if (c == "+" || c == "-")
return 1;
if (c == "*" || c == "/")
return 2;
return 0;
}
double caculator(double x, double y, string c)
{
if (c == "+")
{
return x + y;
}
else if (c == "-")
{
return x - y;
}
else if (c == "*")
{
return x * y;
}
else
{
return x / y;
}
}
int main()
{
// 6/2+3+3*4
string input_str;
while (getline(cin, input_str))
{
input_str = input_str + "#";
string temp_str = "";
stack<double> nums_stack;
stack<string> fuhao_stack;
for (int i = 0; i < input_str.size(); i++)
{
if (!isdigit(input_str[i]))
{
nums_stack.push(stod(temp_str));
temp_str = "";
while (!fuhao_stack.empty() && priority(fuhao_stack.top()) >= priority(string(1,input_str[i])))
{
double a = nums_stack.top();
nums_stack.pop();
double b = nums_stack.top();
nums_stack.pop();
string fuhao = fuhao_stack.top();
fuhao_stack.pop();
double caculate = caculator(b, a, fuhao);
nums_stack.push(caculate);
}
fuhao_stack.push(string(1,input_str[i]));
}
else
{
temp_str = temp_str + input_str[i];
}
}
double result = nums_stack.top();
printf("%.0f", result);
}
}
// 64 位输出请用 printf("%lld")