import java.util.Scanner;

public class Main {
	static int[] str = new int[300];
	static int i = 0;
	static void push(int k) {
		if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++;
			str[i] = k;
		}
	static int pop() {
		if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--;
		return str[i+1];

	}
	static boolean isNumber(String j) {
	    try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	}

	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int size = array.length;
		for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		}
		System.out.println(str[i]);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	static int[] str = new int[300];
	static int i = 0;
	static void push(int k) {
		if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++;
			str[i] = k;
		}
	static int pop() {
		if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--;
		return str[i+1];

	}
	static boolean isNumber(String j) {
	    try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	}

	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int size = array.length;
		for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		}
		System.out.println(str[i]);
	}
} Main static int[] str = new int[300]; str new int[300] 300 static int i = 0; i 0 static void push(int k) {
		if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++;
			str[i] = k;
		} push {
		if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++;
			str[i] = k;
		} if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++; i >=299 i 299 {
			System.out.print("?????????????????????");
			System.exit(1);
		} System.out.print("?????????????????????") System.out.print System.out System System.out "?????????????????????" System.exit(1) System.exit System 1 i++ i str[i] = k str[i] str i k int k k static int pop() {
		if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--;
		return str[i+1];

	} pop {
		if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--;
		return str[i+1];

	} if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--; i == 0 i 0 {
			System.out.print("??¢??????????????????");
			System.exit(1);
		} System.out.print("??¢??????????????????") System.out.print System.out System System.out "??¢??????????????????" System.exit(1) System.exit System 1 i-- i return str[i+1]; str[i+1] str i+1 i 1 static boolean isNumber(String j) {
	    try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	} isNumber {
	    try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	} try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    } catch (NumberFormatException e) {
	        return false;
	    } NumberFormatException e {
	        return false;
	    } return false; false {
	        Integer.parseInt(j);
	        return true;
	        } Integer.parseInt(j) Integer.parseInt Integer j return true; true String j j public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int size = array.length;
		for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		}
		System.out.println(str[i]);
	} main {
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int size = array.length;
		for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		}
		System.out.println(str[i]);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String[] array = in.nextLine().split(" "); array in.nextLine().split(" ") in.nextLine().split in.nextLine() in.nextLine in " " int size = array.length; size array.length array array.length for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		} int h=0; int h=0; h 0 h<size h size h++ h++ h {
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		} {
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		} if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			} array[h].equals("+") array[h].equals array[h] array h "+" {
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			} int b = pop(); b pop() pop int c = pop(); c pop() pop int d = c + b; d c + b c b push(d) push d if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			} array[h].equals("-") array[h].equals array[h] array h "-" {
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			} int b = pop(); b pop() pop int c = pop(); c pop() pop int d = c - b; d c - b c b push(d) push d if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			} array[h].equals("*") array[h].equals array[h] array h "*" {
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			} int b = pop(); b pop() pop int c = pop(); c pop() pop int d = c * b; d c * b c b push(d) push d if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			} isNumber(array[h]) isNumber array[h] array h {
				int k = Integer.parseInt(array[h]);
				push(k);
			} int k = Integer.parseInt(array[h]); k Integer.parseInt(array[h]) Integer.parseInt Integer array[h] array h push(k) push k System.out.println(str[i]) System.out.println System.out System System.out str[i] str i String[] args args public class Main {
	static int[] str = new int[300];
	static int i = 0;
	static void push(int k) {
		if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++;
			str[i] = k;
		}
	static int pop() {
		if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--;
		return str[i+1];

	}
	static boolean isNumber(String j) {
	    try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	}

	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int size = array.length;
		for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		}
		System.out.println(str[i]);
	}
} public class Main {
	static int[] str = new int[300];
	static int i = 0;
	static void push(int k) {
		if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++;
			str[i] = k;
		}
	static int pop() {
		if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--;
		return str[i+1];

	}
	static boolean isNumber(String j) {
	    try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	}

	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int size = array.length;
		for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		}
		System.out.println(str[i]);
	}
} Main
import java.util.Scanner;

public class Main {
	static int[] str = new int[300];
	static int i = 0;
	static void push(int k) {
		if (i >=299){
			System.out.print("?????????????????????");
			System.exit(1);
		}else
			i++;
			str[i] = k;
		}
	static int pop() {
		if (i == 0){
			System.out.print("??¢??????????????????");
			System.exit(1);
		}else
		i--;
		return str[i+1];

	}
	static boolean isNumber(String j) {
	    try {
	        Integer.parseInt(j);
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	}

	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int size = array.length;
		for (int h=0;h<size;h++){
			if (array[h].equals("+")){
				int b = pop();
				int c = pop();
				int d = c + b;
				push(d);
			}
			else if (array[h].equals("-")){
				int b = pop();
				int c = pop();
				int d = c - b;
				push(d);
			}
			else if (array[h].equals("*")){
				int b = pop();
				int c = pop();
				int d = c * b;
				push(d);
			}
			else
				if (isNumber(array[h])){
				int k = Integer.parseInt(array[h]);
				push(k);
			}
		}
		System.out.println(str[i]);
	}
}