import java.util.ArrayDeque;
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
  	ArrayDeque<Integer> a = new ArrayDeque<Integer>();
  	Scanner sc = new Scanner(System.in);
  	
  	while(sc.hasNext()){
  		if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		}
  	}
  	System.out.println(a.pop());

  }
  
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.Scanner; Scanner java.util class Main {
  public static void main(String[] args) {
  	ArrayDeque<Integer> a = new ArrayDeque<Integer>();
  	Scanner sc = new Scanner(System.in);
  	
  	while(sc.hasNext()){
  		if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		}
  	}
  	System.out.println(a.pop());

  }
  
} Main public static void main(String[] args) {
  	ArrayDeque<Integer> a = new ArrayDeque<Integer>();
  	Scanner sc = new Scanner(System.in);
  	
  	while(sc.hasNext()){
  		if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		}
  	}
  	System.out.println(a.pop());

  } main {
  	ArrayDeque<Integer> a = new ArrayDeque<Integer>();
  	Scanner sc = new Scanner(System.in);
  	
  	while(sc.hasNext()){
  		if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		}
  	}
  	System.out.println(a.pop());

  } ArrayDeque<Integer> a = new ArrayDeque<Integer>(); a new ArrayDeque<Integer>() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while(sc.hasNext()){
  		if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		}
  	} sc.hasNext() sc.hasNext sc {
  		if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		}
  	} if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		} sc.hasNextInt() sc.hasNextInt sc {
			a.push(sc.nextInt());
  		} a.push(sc.nextInt()) a.push a sc.nextInt() sc.nextInt sc {
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		} int o1 = a.pop(); o1 a.pop() a.pop a int o2 = a.pop(); o2 a.pop() a.pop a switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			} sc.next().charAt(0) sc.next().charAt sc.next() sc.next sc 0 case '+': '+' case '+': a.push(o1 + o2) a.push a o1 + o2 o1 o2 break; case '-': '-' case '-': a.push(o2 - o1) a.push a o2 - o1 o2 o1 break; case '*': '*' case '*': a.push(o1 * o2) a.push a o1 * o2 o1 o2 break; default: default: break; System.out.println(a.pop()) System.out.println System.out System System.out a.pop() a.pop a String[] args args
import java.util.ArrayDeque;
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
  	ArrayDeque<Integer> a = new ArrayDeque<Integer>();
  	Scanner sc = new Scanner(System.in);
  	
  	while(sc.hasNext()){
  		if(sc.hasNextInt()){
			a.push(sc.nextInt());
  		}else{
  			int o1 = a.pop();
  			int o2 = a.pop();
  			switch(sc.next().charAt(0)){
	  			case '+':
		  			a.push(o1 + o2);
		  			break;
		  		case '-':
		  			a.push(o2 - o1);
		  			break;
		  		case '*':
		  			a.push(o1 * o2);
		  			break;
		  		default:
		  			break;
  			}
  		}
  	}
  	System.out.println(a.pop());

  }
  
}