//不支持单目运算符,没有用逆波兰什么的那些概念,就是简单的入栈和出栈操作
import java.util.Scanner;
import java.util.Stack;
@SuppressWarnings("rawtypes")
public class Main{
static Stack tmpStk=new Stack();
static Stack opStk=new Stack();
//定义运算符优先级
public static int leavel(char s){
switch(s){
case '(': return 0;
case '+':
case '-': return 1;
case '*':
case '/': return 2;
}
return -1;
}
public static int calc(int val1,int val2,char c){
switch(c){
case '+': return val1+val2;
case '-': return val2-val1;
case '*': return val1*val2;
}
if(val1==0) return 0;
return val1/val2;
}
@SuppressWarnings("unchecked")
public static void main(String args[]){
Scanner input=new Scanner(System.in);
String s=input.nextLine();
input.close();
char a[]=s.toCharArray();
boolean flg=false;
for(int i=0;i<s.length();i++)
{
flg=false;
int x=0;
char c=a[i];
while(i<a.length & c<='9' & c>='0')
{
x=x*10+(c-'0');
i++;
if(i<a.length)c=a[i];
flg=true;
}
if(flg)
tmpStk.push(x);
if(c>'9' || c<'0')
{
if(opStk.isEmpty() || c=='(') opStk.push(c);
else if(c==')')
{
while((char)opStk.peek()!='(')
{
int t=calc((int)tmpStk.pop(),(int)tmpStk.pop(),(char)opStk.pop());
tmpStk.push(t);
}
opStk.pop();
}
else if(leavel(c)<=leavel((char)opStk.peek()))
{
int t=calc((int)tmpStk.pop(),(int)tmpStk.pop(),(char)opStk.pop());
tmpStk.push(t);
opStk.push(c);
}
else opStk.push(c);
}
}
while(!opStk.isEmpty())
{
int aa=(int)tmpStk.pop();
int b=(int)tmpStk.pop();
char cc=(char)opStk.pop();
int t=calc(aa,b,cc);
tmpStk.push(t);
}
System.out.println(tmpStk.pop());
}
}