
import java.util.Scanner;
import java.util.Stack;	

public class Main {
	public static void main(String[] args) {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	}
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
	public static void main(String[] args) {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	}
} Main public static void main(String[] args) {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	} main {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	} Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int value = 0; value 0 while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		} scan.hasNext() scan.hasNext scan {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		} String e = scan.next(); e scan.next() scan.next scan if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			} e.equals("+") e.equals e "+" {
				stack.push(stack.pop() + stack.pop());
			} stack.push(stack.pop() + stack.pop()) stack.push stack stack.pop() + stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			} e.equals("-") e.equals e "-" {
				stack.push(-1*(stack.pop() - stack.pop()));
			} stack.push(-1*(stack.pop() - stack.pop())) stack.push stack -1*(stack.pop() - stack.pop()) -1 1 (stack.pop() - stack.pop()) stack.pop() stack.pop stack stack.pop() stack.pop stack if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			} e.equals("*") e.equals e "*" {
				stack.push(stack.pop() * stack.pop());
			} stack.push(stack.pop() * stack.pop()) stack.push stack stack.pop() * stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack {
				stack.push(Integer.parseInt(e));
			} stack.push(Integer.parseInt(e)) stack.push stack Integer.parseInt(e) Integer.parseInt Integer e value = stack.peek() value stack.peek() stack.peek stack System.out.println(value) System.out.println System.out System System.out value String[] args args public class Main {
	public static void main(String[] args) {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	}
} public class Main {
	public static void main(String[] args) {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	}
} Main

import java.util.Scanner;
import java.util.Stack;	

public class Main {
	public static void main(String[] args) {
		//System.out.println("t");
		
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scan = new Scanner(System.in);
		
		int value = 0;
		
		while(scan.hasNext()) {
			String e = scan.next();
			if(e.equals("+")) {
				stack.push(stack.pop() + stack.pop());
			} else if(e.equals("-")) {
				stack.push(-1*(stack.pop() - stack.pop()));
			} else if(e.equals("*")) {
				stack.push(stack.pop() * stack.pop());
			}else {
				stack.push(Integer.parseInt(e));
			}
			value = stack.peek();
			//System.out.println(value);
		}
		//System.out.println("here");
		System.out.println(value);
		
	}
}

