import java.util.Scanner;

public class Main {
	static int stack[] = new int[1000];
	static int counta = 0;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String input[] = (scanner.nextLine()).split(" ");

		for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		}
		System.out.println(pop());
	}

	public static int pop() {
		counta--;
		return stack[counta + 1];
	}

	public static void push(int i) {
		counta++;
		stack[counta] = i;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	static int stack[] = new int[1000];
	static int counta = 0;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String input[] = (scanner.nextLine()).split(" ");

		for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		}
		System.out.println(pop());
	}

	public static int pop() {
		counta--;
		return stack[counta + 1];
	}

	public static void push(int i) {
		counta++;
		stack[counta] = i;
	}
} Main static int stack[] = new int[1000]; stack new int[1000] 1000 static int counta = 0; counta 0 public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String input[] = (scanner.nextLine()).split(" ");

		for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		}
		System.out.println(pop());
	} main {

		Scanner scanner = new Scanner(System.in);

		String input[] = (scanner.nextLine()).split(" ");

		for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		}
		System.out.println(pop());
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String input[] = (scanner.nextLine()).split(" "); input (scanner.nextLine()).split(" ") (scanner.nextLine()).split (scanner.nextLine()) scanner.nextLine scanner " " for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		} int i = 0; int i = 0; i 0 i < input.length i input.length input input.length i++ i++ i {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		} {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		} if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			} input[i].equals("*") input[i].equals input[i] input i "*" {
				push(pop() * pop());

			} push(pop() * pop()) push pop() * pop() pop() pop pop() pop if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			} input[i].equals("+") input[i].equals input[i] input i "+" {
				push(pop() + pop());

			} push(pop() + pop()) push pop() + pop() pop() pop pop() pop if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			} input[i].equals("-") input[i].equals input[i] input i "-" {
				push(-pop() + pop());

			} push(-pop() + pop()) push -pop() + pop() -pop() pop() pop pop() pop {
				push(Integer.parseInt(input[i]));

			} push(Integer.parseInt(input[i])) push Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i System.out.println(pop()) System.out.println System.out System System.out pop() pop String[] args args public static int pop() {
		counta--;
		return stack[counta + 1];
	} pop {
		counta--;
		return stack[counta + 1];
	} counta-- counta return stack[counta + 1]; stack[counta + 1] stack counta + 1 counta 1 public static void push(int i) {
		counta++;
		stack[counta] = i;
	} push {
		counta++;
		stack[counta] = i;
	} counta++ counta stack[counta] = i stack[counta] stack counta i int i i public class Main {
	static int stack[] = new int[1000];
	static int counta = 0;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String input[] = (scanner.nextLine()).split(" ");

		for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		}
		System.out.println(pop());
	}

	public static int pop() {
		counta--;
		return stack[counta + 1];
	}

	public static void push(int i) {
		counta++;
		stack[counta] = i;
	}
} public class Main {
	static int stack[] = new int[1000];
	static int counta = 0;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String input[] = (scanner.nextLine()).split(" ");

		for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		}
		System.out.println(pop());
	}

	public static int pop() {
		counta--;
		return stack[counta + 1];
	}

	public static void push(int i) {
		counta++;
		stack[counta] = i;
	}
} Main
import java.util.Scanner;

public class Main {
	static int stack[] = new int[1000];
	static int counta = 0;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String input[] = (scanner.nextLine()).split(" ");

		for (int i = 0; i < input.length; i++) {
			if (input[i].equals("*")) {
				push(pop() * pop());

			} else if (input[i].equals("+")) {
				push(pop() + pop());

			} else if (input[i].equals("-")) {
				push(-pop() + pop());

			} else {
				push(Integer.parseInt(input[i]));

			}
		}
		System.out.println(pop());
	}

	public static int pop() {
		counta--;
		return stack[counta + 1];
	}

	public static void push(int i) {
		counta++;
		stack[counta] = i;
	}
}
