#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>

using namespace std;

int priority(char c)
{
	if (c == '+' || c == '-')
	{
		return 1;
	}
	else if(c=='*'||c=='/')
	{
		return 2;
	}
	else
	{
		return 0;
	}
}

bool isdigit(char c)
{
	if (c == '+' || c == '-' || c == '*' || c == '/'||c=='#')
	{
		return false;
	}
	else
	{
		return true;
	}
}
double cal(double number1, double number2, char operation)
{
	if (operation == '+')
	{
		return number2 + number1;
	}
	if (operation == '-')
	{
		return number2 - number1;
	}
	if (operation == '*')
	{
		return number2 * number1;
	}
	if (operation == '/')
	{
		return number2 / number1;
	}
    return 0;
}

double caculate(string input_str)
{
	stack<double> number_stack;
	stack<char>operation_stack;
	input_str = input_str + "#";
	string  temp = "";
	for (int i = 0; i <(int)input_str.size(); i++)
	{
		char c = input_str[i];
		if (isdigit(c))
		{
			temp = temp + c;
		}
		else
		{
			number_stack.push(stod(temp));
			temp = "";
			while (operation_stack.empty()==false&& priority(operation_stack.top())>=priority(c))
			{
				double number1 = number_stack.top(); number_stack.pop();
				double number2 = number_stack.top(); number_stack.pop();
				char operation = operation_stack.top(); operation_stack.pop();
				double result = cal(number1, number2, operation);
				number_stack.push(result);
			}
			operation_stack.push(c);
		}
	}
	return number_stack.top();
}

int main()
{
	string input_str;
	getline(cin, input_str);
	double result = caculate(input_str);
	printf("%.0f\n",result);


}