#include<iostream>
#include<cstring>
#include<algorithm>
#include<stack>
#include<unordered_map>
using namespace std;
unordered_map<char,int> h = {{'+',1},{'-',1},{'*',2},{'/',2}};
stack<int> num;
stack<char> op;
void eval()
{
int x,y,res;
char p;
x = num.top();
num.pop();
y = num.top();
num.pop();
p = op.top();
op.pop();
if(p=='+') res = y+x;
if(p=='-') res = y-x;
if(p=='*') res = y*x;
if(p=='/') res = y/x;
num.push(res);
}
int main()
{
string s;
cin>>s;
for(int i=0;i<s.length();i++)
{
if(isdigit(s[i]))
{
int x = 0,j =i;
while(j<s.length()&&isdigit(s[j]))
x = x*10 + s[j++] - '0';
i=j-1;
num.push(x);
}
else if(s[i]=='(')
op.push(s[i]);
else if(s[i]==')')
{
while(op.top() != '(')
eval();
op.pop();
}
else
{
while(op.size() && h[op.top()] >= h[s[i]])
eval();
op.push(s[i]);
}
}
while(op.size())
eval();
cout<<num.top();
}