#include<stdio.h>
#include<string.h>
int push( int Stack[], int *ptop, int x ){

  Stack[*ptop] = x;
  *ptop += 1;
  
  return 0;
  
}
int pop( int Stack[], int *ptop ){

  *ptop -= 1;
  return Stack[*ptop];

}
int main(){

  char S[8];
  int len,i,x,Stack[101],top;
  top = 0;

  
  while( scanf("%s", S ) != EOF ){

    if ( S[0] == '@' ) {
      break;
    }

    if ( S[0] == '+' ){
      x = pop( Stack, &top ) + pop( Stack, &top );
      push( Stack, &top, x );
    } else if ( S[0] == '-' ){
      x = pop( Stack, &top ) - pop( Stack, &top );
      push( Stack, &top, x );
    } else if ( S[0] == '*' ){
      x = pop( Stack, &top ) * pop( Stack, &top );
      push( Stack, &top, x );
    } else {
      
      len = strlen(S);
      x = 0;
      
      for ( i = 0 ; i < len ; i++ ){
	x = 10 * x + ( S[i] - '0' );
      }

      push ( Stack, &top, x );
      
    }
  }
  
  printf("%d\n", Stack[0] );
  
  return 0;
    
    
}