#include <cstdio>
#include <cstdlib>
#include <cctype>
using namespace std;
#define MAXSIZE 100
struct seq {
char st[MAXSIZE];
int top;
};
struct op {
int data[MAXSIZE];
int top;
};
bool isEmpty(seq *s) {
return (!(~(s -> top)));
}
bool push(seq *s, char c) {
if(s -> top == MAXSIZE) return false;
s -> st[++s -> top] = c;
return true;
}
bool pop(seq *s, char *c) {
if(isEmpty(s)) return false;
*c = s -> st[s -> top];
s -> top--;
return true;
}
bool getTop(seq *s, char *c) {
if(isEmpty(s)) return false;
*c = s -> st[s -> top];
return true;
}
void trans(char s1[], char s2[]) {
seq s;
char ch, e = '\0';
int i = 0, j = 0;
s.top = -1;
ch = s1[i++];
while(ch != '\0') {
switch(ch) {
case '(':
push(&s, ch);
break;
case ')':
while(getTop(&s, &e) && e != '(') {
pop(&s, &e);
s2[j++] = e;
}
pop(&s, &e);
break;
case '+':
case '-':
while(!isEmpty(&s) && getTop(&s, &e) && e != '(') {
pop(&s, &e);
s2[j++] = e;
}
push(&s, ch);
break;
case '*':
case '/':
while(!isEmpty(&s) && getTop(&s, &e) && (e == '/' || e == '*')) {
pop(&s, &e);
s2[j++] = e;
}
push(&s, ch);
break;
case ' ':
break;
default:
while(isdigit(ch)) {
s2[j++] = ch;
ch = s1[i++];
}
i--;
s2[j++] = ' ';
}
ch = s1[i++];
}
while(!isEmpty(&s)) {
pop(&s, &e);
if(e != ' ') s2[j++] = e;
}
s2[j] = '\0';
}
int cal(char a[]) {
op s;
int i = 0, data, res = 0;
int x1, x2;
s.top = -1;
while(a[i] != '\0') {
if(isdigit(a[i])) {
data = 0;
while(a[i] != ' ') {
data = data * 10 + a[i] - '0';
i++;
}
s.data[++s.top] = data;
}
else {
switch(a[i]) {
case '+':
x1 = s.data[s.top--];
x2 = s.data[s.top--];
res = x1 + x2;
s.data[++s.top] = res;
break;
case '-':
x1 = s.data[s.top--];
x2 = s.data[s.top--];
res = x2 - x1;
s.data[++s.top] = res;
break;
case '*':
x1 = s.data[s.top--];
x2 = s.data[s.top--];
res = x1 * x2;
s.data[++s.top] = res;
break;
case '/':
x1 = s.data[s.top--];
x2 = s.data[s.top--];
res = x2 / x1;
s.data[++s.top] = res;
break;
}
}
i++;
}
if(s.top != -1) res = s.data[s.top--];
return res;
}
int main() {
char str1[MAXSIZE], str2[MAXSIZE];
fgets(str1, 100, stdin);
trans(str1, str2);
printf("%d\n", cal(str2));
return 0;
}