
import java.util.Stack;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	}
}
 import java.util.Stack; Stack java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	}
} Main public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	} main {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) Stack<String> expr = new Stack<>(); expr new Stack<>() while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		} in.hasNext() in.hasNext in {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		} String next = in.next(); next in.next() in.next in if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			} next.equals("+") next.equals next "+" {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} int a = Integer.parseInt(expr.pop()); a Integer.parseInt(expr.pop()) Integer.parseInt Integer expr.pop() expr.pop expr int b = Integer.parseInt(expr.pop()); b Integer.parseInt(expr.pop()) Integer.parseInt Integer expr.pop() expr.pop expr int result = a + b; result a + b a b expr.push((result + "")) expr.push expr (result + "") result "" if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			} next.equals("-") next.equals next "-" {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} int a = Integer.parseInt(expr.pop()); a Integer.parseInt(expr.pop()) Integer.parseInt Integer expr.pop() expr.pop expr int b = Integer.parseInt(expr.pop()); b Integer.parseInt(expr.pop()) Integer.parseInt Integer expr.pop() expr.pop expr int result = b - a; result b - a b a expr.push((result + "")) expr.push expr (result + "") result "" if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			} next.equals("*") next.equals next "*" {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} int a = Integer.parseInt(expr.pop()); a Integer.parseInt(expr.pop()) Integer.parseInt Integer expr.pop() expr.pop expr int b = Integer.parseInt(expr.pop()); b Integer.parseInt(expr.pop()) Integer.parseInt Integer expr.pop() expr.pop expr int result = a * b; result a * b a b expr.push((result + "")) expr.push expr (result + "") result "" {
				expr.push(next);
			} expr.push(next) expr.push expr next System.out.println(expr.peek()) System.out.println System.out System System.out expr.peek() expr.peek expr String[] args args public class Main {
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	}
} public class Main {
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	}
} Main

import java.util.Stack;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		Stack<String> expr = new Stack<>();
		while (in.hasNext()) {
			String next = in.next();
			if (next.equals("+")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a + b;
				expr.push((result + ""));
			} else if(next.equals("-")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = b - a;
				expr.push((result + ""));
			} else if (next.equals("*")) {
				int a = Integer.parseInt(expr.pop());
				int b = Integer.parseInt(expr.pop());
				int result = a * b;
				expr.push((result + ""));
			} else {
				expr.push(next);
			}
			
		}
		System.out.println(expr.peek());
	}
}

