#include <iostream>
using namespace std;
int top=0;
int s[1001];
void push(int n){
if(top<299){
top++;
s[top]=n;
return;
}
}
void pop() {
if(top>0){
top--;
}
}
int gettop(){
return s[top];
}
void clear(){
top=0;
}
int main()
{
int a;
char b;
int h;
int sum=0;
cin>>a;
push(a);
while(cin>>b&&b!='='){
cin>>a;
if(b=='+'){
push(a);
}else if(b=='-'){
push(-a);
}else if(b=='*'){
h=gettop();
pop();
push(a*h);
}else if(b=='/'){
h=gettop();
pop();
push(a/h);
}
}
while(top!=0){
sum+=s[top];
pop();
}
cout<<sum<<endl;
return 0;
}