import java.util.*;

public class Main {

	public static void main(String args[]) {
		Stack<Integer> myStack = new Stack<Integer>();
		
		Scanner in = new Scanner(System.in);
		String problem = in.nextLine();
		
		Scanner problemScanner = new Scanner(problem);
		
		while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		}
		
		System.out.println(myStack.pop());
		
		
		
		
	}

} import java.util.*; util.* java public class Main {

	public static void main(String args[]) {
		Stack<Integer> myStack = new Stack<Integer>();
		
		Scanner in = new Scanner(System.in);
		String problem = in.nextLine();
		
		Scanner problemScanner = new Scanner(problem);
		
		while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		}
		
		System.out.println(myStack.pop());
		
		
		
		
	}

} Main public static void main(String args[]) {
		Stack<Integer> myStack = new Stack<Integer>();
		
		Scanner in = new Scanner(System.in);
		String problem = in.nextLine();
		
		Scanner problemScanner = new Scanner(problem);
		
		while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		}
		
		System.out.println(myStack.pop());
		
		
		
		
	} main {
		Stack<Integer> myStack = new Stack<Integer>();
		
		Scanner in = new Scanner(System.in);
		String problem = in.nextLine();
		
		Scanner problemScanner = new Scanner(problem);
		
		while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		}
		
		System.out.println(myStack.pop());
		
		
		
		
	} Stack<Integer> myStack = new Stack<Integer>(); myStack new Stack<Integer>() Scanner in = new Scanner(System.in); in new Scanner(System.in) String problem = in.nextLine(); problem in.nextLine() in.nextLine in Scanner problemScanner = new Scanner(problem); problemScanner new Scanner(problem) while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		} problemScanner.hasNext() problemScanner.hasNext problemScanner {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		} if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			} problemScanner.hasNextInt() problemScanner.hasNextInt problemScanner {
				myStack.push(problemScanner.nextInt());
			} myStack.push(problemScanner.nextInt()) myStack.push myStack problemScanner.nextInt() problemScanner.nextInt problemScanner {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			} String operator = problemScanner.next(); operator problemScanner.next() problemScanner.next problemScanner int a = myStack.pop(); a myStack.pop() myStack.pop myStack int b = myStack.pop(); b myStack.pop() myStack.pop myStack switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				} operator case "+" : "+" case "+" : myStack.push(a + b) myStack.push myStack a + b a b break; case "-" : "-" case "-" : myStack.push(b - a) myStack.push myStack b - a b a break; case "*" : "*" case "*" : myStack.push(b * a) myStack.push myStack b * a b a break; default : default : break; System.out.println(myStack.pop()) System.out.println System.out System System.out myStack.pop() myStack.pop myStack String args[] args public class Main {

	public static void main(String args[]) {
		Stack<Integer> myStack = new Stack<Integer>();
		
		Scanner in = new Scanner(System.in);
		String problem = in.nextLine();
		
		Scanner problemScanner = new Scanner(problem);
		
		while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		}
		
		System.out.println(myStack.pop());
		
		
		
		
	}

} public class Main {

	public static void main(String args[]) {
		Stack<Integer> myStack = new Stack<Integer>();
		
		Scanner in = new Scanner(System.in);
		String problem = in.nextLine();
		
		Scanner problemScanner = new Scanner(problem);
		
		while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		}
		
		System.out.println(myStack.pop());
		
		
		
		
	}

} Main
import java.util.*;

public class Main {

	public static void main(String args[]) {
		Stack<Integer> myStack = new Stack<Integer>();
		
		Scanner in = new Scanner(System.in);
		String problem = in.nextLine();
		
		Scanner problemScanner = new Scanner(problem);
		
		while(problemScanner.hasNext()) {
			if(problemScanner.hasNextInt()) {
				myStack.push(problemScanner.nextInt());
			}
			else {
				String operator = problemScanner.next();
				
				int a = myStack.pop();
				int b = myStack.pop();
				
				switch(operator) {
				case "+" : myStack.push(a + b);
				break;
				case "-" : myStack.push(b - a);
				break;
				case "*" : myStack.push(b * a);
				break;
				default : break;
				}
			}
			
			
		}
		
		System.out.println(myStack.pop());
		
		
		
		
	}

}
