#include <fstream>
#include <stack>
#include <string>
using namespace std;
ifstream cin("evaluare.in");
ofstream cout("evaluare.out");
stack<int>nr;
stack<char>semn;
string s;
int i,pr[256];
int get_number(){
int n=0;
while(s[i]>='0'&&s[i]<='9')
n=n*10+s[i++]-'0';
return n;
}
void eval(){
int b=nr.top();
nr.pop();
int a=nr.top();
nr.pop();
char x=semn.top();
semn.pop();
if(x=='+')
nr.push(a+b);
else if(x=='-')
nr.push(a-b);
else if(x=='*')
nr.push(a*b);
else nr.push(a/b);
}
/// + = 1 - = 1 * = 2 / = 2 ( = 3
int main()
{
cin>>s;
pr['-']=pr['+']=1;
pr['*']=pr['/']=2;
i=0;
while(s[i]!=0){
if(s[i]>='0'&&s[i]<='9'){
nr.push(get_number());
}else if(s[i]=='('){
semn.push(s[i++]);
}else if(s[i]==')'){
i++;
while(semn.top()!='(')
eval();
semn.pop();
}else{
while(!semn.empty()&&pr[semn.top()]>=pr[s[i]])
eval();
semn.push(s[i++]);
}
}
while(!semn.empty())
eval();
cout<<nr.top();
return 0;
}