import java.util.*;
import java.io.*;
public class Main{
public static void main(String [] args) throws Exception{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String str = bf.readLine();
int x = 0;
System.out.print(calc(str));
}
public static int calc(String str){
Stack<Integer> stack=new Stack<>();
int n = str.length();
char [] arr = str.toCharArray();
int num =0;
char sign='+';//定义字符串,第一次的时候一定是+;
for(int i=0;i<n;i++){
char x = arr[i];
if(x ==' ')continue;//空格 继续
if(Character.isDigit(x)){
num =10*num + x-'0';//纯数字,一直累加
}
if(x == '('){//当遇到左括号时,把这一部分拿出来计算
int j = i+1;
int count=1;
while(count>0){//括号 对等
if(arr[j]=='(')count++;
if(arr[j]==')')count--;
j++;
}
num=calc(str.substring(i+1,j-1));//递归计算括号里里面的值
i=j-1;//while中多加了一次,待会还要执行i++,所以这里要减一
}
if(!Character.isDigit(x) || i== n-1){
if(sign == '+'){
stack.push(num);
}else if(sign == '-'){
stack.push(-1*num);
}else if(sign =='*'){
stack.push(stack.pop()*num);
}else if(sign =='/'){
stack.push(stack.pop()/num);
}
num=0;
sign=x;
}
}
int sum=0;
while(!stack.isEmpty()){
sum+=stack.pop();
}
return sum;
}
}