#include <bits/stdc++.h>
using namespace std;
#define haha ios::sync_with_stdio(0), cin.tie(0);
int main(){
haha;
stack <int> st;
char in[110];
cin >> in;
st.push(in[0]-48);
for(int i=1, len=strlen(in); i<len; i+=2){
if(in[i] == '+') st.push(in[i+1]-48);
else if(in[i] == '-') st.push(-1*(in[i+1]-48));
else if(in[i] == '*'){
int tmp = st.top();
st.pop();
tmp *= (in[i+1]-48);
st.push(tmp);
}
else if(in[i] == '/'){
int tmp = st.top();
st.pop();
tmp /= (in[i+1]-48);
st.push(tmp);
}
}
long long total;
while(1){
if(st.empty()) break;
total += st.top();
st.pop();
}
cout << total << "\n";
}