#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int Number_chack(char);


int main(void){

  int i,j,num;
  char tmp;
  int nowline =0;
  char operator;
  int matrix_preresult[200];
  char matrix_pre_date[200];
  char *matrix_date;


  scanf("%s",matrix_pre_date);

  num = strlen(matrix_pre_date);
  matrix_date = malloc(sizeof(char) * num);
  strcpy(matrix_date,matrix_pre_date);

  for( i = 0; i < 3 ; i++){ //num と cpy までは正常

    if((tmp = Number_chack(matrix_date[i])) != 0){
      //fprintf(stderr,"関数検査%d回目 : %d\n",i+1,tmp);
      
      matrix_preresult[nowline] = tmp;
      
      nowline++;
      //fprintf(stderr,"nowline検査 %d\n",nowline);
    }
    //fprintf(stderr,"符号検査 %d\n",tmp);

    if( tmp == 0 ){

      operator = matrix_date[i];
      nowline--;
      
      if( operator == '+')matrix_preresult[nowline-1] = matrix_preresult[nowline-1] + matrix_preresult[nowline];

      else if(operator == '-')matrix_preresult[nowline-1] = matrix_preresult[nowline-1] - matrix_preresult[nowline];

      else if(operator == '*')matrix_preresult[nowline-1] = matrix_preresult[nowline-1] * matrix_preresult[nowline];

    }
    //fprintf(stderr,"nowline検査 %d\n",nowline);
  }

  printf("%d\n",matrix_preresult[nowline-1]);

  free(matrix_date);

  return 0;


}



int Number_chack(char input_word){
  int return_num;
  static i = 0;

  //fprintf(stderr,"%c\n",input_word);

  if(input_word == '+' || input_word == '-' || input_word == '*') return 0;

  else {
    return_num = input_word;
    return_num = return_num -48;
    i++;
    //fprintf(stderr,"検査%d回目 :%d\n",i,return_num);
    return return_num;
       
}

}