#include <bits/stdc++.h>
using namespace std;
string s, num = "";
stack<long long> n;
long long a, b;
long long js(long long a, long long b, char c)
{
switch (c)
{
case '+':
return a + b;
case '-':
return a - b;
case '*':
return a * b;
case '/':
return a / b;
}
}
int main()
{
getline(cin, s);
for (int i = 0; s[i] != '@'; i++)
{
if (s[i] >= '0' && s[i] <= '9')
num += s[i];
else if (s[i] == ' ')
{
n.push(stol(num));
num = "";
}
else
{
b = n.top();
n.pop();
a = n.top();
n.pop();
n.push(js(a, b, s[i]));
}
}
cout << n.top();
return 0;
}