import java.util.Scanner;

public class Main {

	static int top;
	static int[] S = new int[1000];

	public static void push(int x) {
		top++;
		S[top] = x;
	}

	public static int pop() {
		top--;
		return S[top + 1];
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		top = 0;
		while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		}
		System.out.println(pop());
		sc.close();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {

	static int top;
	static int[] S = new int[1000];

	public static void push(int x) {
		top++;
		S[top] = x;
	}

	public static int pop() {
		top--;
		return S[top + 1];
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		top = 0;
		while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		}
		System.out.println(pop());
		sc.close();
	}
} Main static int top; top static int[] S = new int[1000]; S new int[1000] 1000 public static void push(int x) {
		top++;
		S[top] = x;
	} push {
		top++;
		S[top] = x;
	} top++ top S[top] = x S[top] S top x int x x public static int pop() {
		top--;
		return S[top + 1];
	} pop {
		top--;
		return S[top + 1];
	} top-- top return S[top + 1]; S[top + 1] S top + 1 top 1 public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		top = 0;
		while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		}
		System.out.println(pop());
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		top = 0;
		while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		}
		System.out.println(pop());
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a a b; b String s; s top = 0 top 0 while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		} sc.hasNext() sc.hasNext sc {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		} s = sc.next() s sc.next() sc.next sc if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			} s.charAt(0) == '+' s.charAt(0) s.charAt s 0 '+' {
				b = pop();
				a = pop();
				push(a + b);
			} b = pop() b pop() pop a = pop() a pop() pop push(a + b) push a + b a b if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			} s.charAt(0) == '-' s.charAt(0) s.charAt s 0 '-' {
				b = pop();
				a = pop();
				push(a - b);
			} b = pop() b pop() pop a = pop() a pop() pop push(a - b) push a - b a b if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			} s.charAt(0) == '*' s.charAt(0) s.charAt s 0 '*' {
				b = pop();
				a = pop();
				push(a * b);
			} b = pop() b pop() pop a = pop() a pop() pop push(a * b) push a * b a b {
				push(Integer.parseInt(s));
			} push(Integer.parseInt(s)) push Integer.parseInt(s) Integer.parseInt Integer s System.out.println(pop()) System.out.println System.out System System.out pop() pop sc.close() sc.close sc String[] args args public class Main {

	static int top;
	static int[] S = new int[1000];

	public static void push(int x) {
		top++;
		S[top] = x;
	}

	public static int pop() {
		top--;
		return S[top + 1];
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		top = 0;
		while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		}
		System.out.println(pop());
		sc.close();
	}
} public class Main {

	static int top;
	static int[] S = new int[1000];

	public static void push(int x) {
		top++;
		S[top] = x;
	}

	public static int pop() {
		top--;
		return S[top + 1];
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		top = 0;
		while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		}
		System.out.println(pop());
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	static int top;
	static int[] S = new int[1000];

	public static void push(int x) {
		top++;
		S[top] = x;
	}

	public static int pop() {
		top--;
		return S[top + 1];
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		top = 0;
		while (sc.hasNext()) {
			s = sc.next();
			if (s.charAt(0) == '+') {
				b = pop();
				a = pop();
				push(a + b);
			} else if (s.charAt(0) == '-') {
				b = pop();
				a = pop();
				push(a - b);
			} else if (s.charAt(0) == '*') {
				b = pop();
				a = pop();
				push(a * b);
			} else {
				push(Integer.parseInt(s));
			}
		}
		System.out.println(pop());
		sc.close();
	}
}

