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

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Deque<Integer> numbers = new ArrayDeque<>();
		String str;
		int a = 0;
		int b = 0;

		while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		}

		System.out.println(numbers.peek());

	}
}
 import java.util.ArrayDeque; ArrayDeque java.util import java.util.Deque; Deque java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Deque<Integer> numbers = new ArrayDeque<>();
		String str;
		int a = 0;
		int b = 0;

		while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		}

		System.out.println(numbers.peek());

	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Deque<Integer> numbers = new ArrayDeque<>();
		String str;
		int a = 0;
		int b = 0;

		while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		}

		System.out.println(numbers.peek());

	} main {
		Scanner scan = new Scanner(System.in);
		Deque<Integer> numbers = new ArrayDeque<>();
		String str;
		int a = 0;
		int b = 0;

		while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		}

		System.out.println(numbers.peek());

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Deque<Integer> numbers = new ArrayDeque<>(); numbers new ArrayDeque<>() String str; str int a = 0; a 0 int b = 0; b 0 while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		} scan.hasNext() scan.hasNext scan {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		} str = scan.next() str scan.next() scan.next scan switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			} str case "+": "+" case "+": a = numbers.pop() a numbers.pop() numbers.pop numbers b = numbers.pop() b numbers.pop() numbers.pop numbers numbers.push(a + b) numbers.push numbers a + b a b break; case "-": "-" case "-": b = numbers.pop() b numbers.pop() numbers.pop numbers a = numbers.pop() a numbers.pop() numbers.pop numbers numbers.push(a - b) numbers.push numbers a - b a b break; case "*": "*" case "*": a = numbers.pop() a numbers.pop() numbers.pop numbers b = numbers.pop() b numbers.pop() numbers.pop numbers numbers.push(a * b) numbers.push numbers a * b a b break; default: default: numbers.push(Integer.parseInt(str)) numbers.push numbers Integer.parseInt(str) Integer.parseInt Integer str System.out.println(numbers.peek()) System.out.println System.out System System.out numbers.peek() numbers.peek numbers String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Deque<Integer> numbers = new ArrayDeque<>();
		String str;
		int a = 0;
		int b = 0;

		while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		}

		System.out.println(numbers.peek());

	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Deque<Integer> numbers = new ArrayDeque<>();
		String str;
		int a = 0;
		int b = 0;

		while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		}

		System.out.println(numbers.peek());

	}
} Main
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Deque<Integer> numbers = new ArrayDeque<>();
		String str;
		int a = 0;
		int b = 0;

		while(scan.hasNext()) {
			str = scan.next();
			switch(str) {
				case "+":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a + b);
					break;
				case "-":
					b = numbers.pop();
					a = numbers.pop();
					numbers.push(a - b);
					break;
				case "*":
					a = numbers.pop();
					b = numbers.pop();
					numbers.push(a * b);
					break;
				default:
					numbers.push(Integer.parseInt(str));
			}

		}

		System.out.println(numbers.peek());

	}
}

