import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split(" ");
		int[] num = new int[str.length];
		int i = 0;

		for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		}
		System.out.println(num[i-1]);
	}

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

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split(" ");
		int[] num = new int[str.length];
		int i = 0;

		for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		}
		System.out.println(num[i-1]);
	}

} Main public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split(" ");
		int[] num = new int[str.length];
		int i = 0;

		for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		}
		System.out.println(num[i-1]);
	} main {

		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split(" ");
		int[] num = new int[str.length];
		int i = 0;

		for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		}
		System.out.println(num[i-1]);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] str = sc.nextLine().split(" "); str sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] num = new int[str.length]; num new int[str.length] str.length str str.length int i = 0; i 0 for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		} int j = 0; int j = 0; j 0 j < str.length j str.length str str.length j++ j++ j {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		} {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		} String temp = str[j]; temp str[j] str j if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			} temp.matches("[0-9]{1,}") temp.matches temp "[0-9]{1,}" {
				num[i] = Integer.parseInt(temp);
				i++;
			} num[i] = Integer.parseInt(temp) num[i] num i Integer.parseInt(temp) Integer.parseInt Integer temp i++ i {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			} switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				} temp case "+" : "+" case "+" : num[i-2] = num[i-2] + num[i-1] num[i-2] num i-2 i 2 num[i-2] + num[i-1] num[i-2] num i-2 i 2 num[i-1] num i-1 i 1 i-- i break; case "-" : "-" case "-" : num[i-2] = num[i-2] - num[i-1] num[i-2] num i-2 i 2 num[i-2] - num[i-1] num[i-2] num i-2 i 2 num[i-1] num i-1 i 1 i-- i break; case "*" : "*" case "*" : num[i-2] = num[i-2] * num[i-1] num[i-2] num i-2 i 2 num[i-2] * num[i-1] num[i-2] num i-2 i 2 num[i-1] num i-1 i 1 i-- i break; System.out.println(num[i-1]) System.out.println System.out System System.out num[i-1] num i-1 i 1 String[] args args public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split(" ");
		int[] num = new int[str.length];
		int i = 0;

		for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		}
		System.out.println(num[i-1]);
	}

} public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split(" ");
		int[] num = new int[str.length];
		int i = 0;

		for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		}
		System.out.println(num[i-1]);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		String[] str = sc.nextLine().split(" ");
		int[] num = new int[str.length];
		int i = 0;

		for(int j = 0; j < str.length; j++) {

			String temp = str[j];

			if(temp.matches("[0-9]{1,}")) {
				num[i] = Integer.parseInt(temp);
				i++;
			} else {
				switch(temp) {
				case "+" :
					num[i-2] = num[i-2] + num[i-1];
					i--;
					break;
				case "-" :
					num[i-2] = num[i-2] - num[i-1];
					i--;
					break;
				case "*" :
					num[i-2] = num[i-2] * num[i-1];
					i--;
					break;

				}
			}
		}
		System.out.println(num[i-1]);
	}

}
