#include <stdio.h>
#include <stack>
#include <string>
#include <iostream>
using namespace std;
string str;
double Cal()
{
stack<double> s;
int temp1, temp2, temp;
for(int i = 0; i < str.size(); i++)
{
if(str[i] >= '0' && str[i] <= '9')
{
s.push(str[i] - '0');
}
else if(str[i] == '+')
{
temp2 = s.top();
s.pop();
temp1 = s.top();
s.pop();
temp = temp1 + temp2;
s.push(temp);
}
else if(str[i] == '-')
{
temp2 = s.top();
s.pop();
temp1 = s.top();
s.pop();
temp = temp1 - temp2;
s.push(temp);
}
else if(str[i] == '*')
{
temp2 = s.top();
s.pop();
temp1 = s.top();
s.pop();
temp = temp1 * temp2;
s.push(temp);
}
else if(str[i] == '/')
{
temp2 = s.top();
s.pop();
temp1 = s.top();
s.pop();
temp = temp1 / temp2;
s.push(temp);
}
}
return s.top();
}
int main(void)
{
getline(cin, str);
printf("%.0f\n", Cal());
return 0;
}