#include <iostream>
#include <stack>
#include <string>
using namespace std;
stack<long long> st;
string s;
int main()
{
long long sum = 0;
cin >> s;
for (int i = 0; i < s.size(); i++)
{
long long a, b;
if (s[i] == '.') continue;
if (s[i] == '@')
{
cout << st.top();
return 0;
}
if (s[i] == '+' || s[i] == '-' || s[i] == '*' || s[i] == '/')
{
a = st.top();
st.pop();
b = st.top();
st.pop();
if (s[i] == '+') st.push(a + b);
if (s[i] == '-') st.push(b - a);
if (s[i] == '*') st.push(a * b);
if (s[i] == '/') st.push(b / a);
continue;
}
st.push(s[i] - '0');
}
}