#include<iostream>
#include<stdio.h>
#include<stack>
using namespace std;
stack<int>s;
int main()
{
char c;
int num = 0;
while (1)
{
cin >> c;
if (c >= '0' && c >= '9')
{
num = num * 10 + c - '0';
}
else if (c == '.')
{
s.push(num);
num = 0;
}
else if (c == '+')
{
int num1 = s.top();
s.pop();
int num2 = s.top();
s.pop();
s.push(num1 + num2);
}
else if (c == '-')
{
int num1 = s.top();
s.pop();
int num2 = s.top();
s.pop();
s.push(num2 - num1);
}
else if (c == '*')
{
int num1 = s.top();
s.pop();
int num2 = s.top();
s.pop();
s.push(num1 * num2);
}
else if (c == '/')
{
int num1 = s.top();
s.pop();
int num2 = s.top();
s.pop();
s.push(num2 / num1);
}
else if (c == '@')
{
break;
}
}
cout << s.top();
}