import java.util.*;

public class Main {	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	}
	
}
 import java.util.*; util.* java public class Main {	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	}
	
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	} main {
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayDeque<Integer> s = new ArrayDeque<>(); s new ArrayDeque<>() while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		} sc.hasNext() sc.hasNext sc {
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		} String str = sc.next(); str sc.next() sc.next sc switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			} str case "+": "+" case "+": s.push(s.pop() + s.pop()) s.push s s.pop() + s.pop() s.pop() s.pop s s.pop() s.pop s break; case "-": "-" case "-": s.push(-1 * s.pop() + s.pop()) s.push s -1 * s.pop() + s.pop() -1 * s.pop() -1 1 s.pop() s.pop s s.pop() s.pop s break; case "*": "*" case "*": s.push(s.pop() * s.pop()) s.push s s.pop() * s.pop() s.pop() s.pop s s.pop() s.pop s break; default: default: s.push(Integer.parseInt(str)) s.push s Integer.parseInt(str) Integer.parseInt Integer str System.out.println(s.pop()) System.out.println System.out System System.out s.pop() s.pop s String args[] args public class Main {	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	}
	
} public class Main {	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	}
	
} Main
import java.util.*;

public class Main {	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		ArrayDeque<Integer> s = new ArrayDeque<>();
		
		while(sc.hasNext()){
			String str = sc.next();
			
			switch(str){
			case "+":
				s.push(s.pop() + s.pop());
				break;
			case "-":
				s.push(-1 * s.pop() + s.pop());
				break;
			case "*":
				s.push(s.pop() * s.pop());
				break;
			default:
				s.push(Integer.parseInt(str));
			}
		}
		
		System.out.println(s.pop());
	}
	
}

