import java.util.Scanner;
import java.util.Stack;

public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] arr = line.split(" ");
		int first = 0;
		int sec = 0;
		//System.out.println(Arrays.toString(arr));
		Stack<Integer> st = new Stack<Integer>();
		for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		}
		if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		}
	}
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] arr = line.split(" ");
		int first = 0;
		int sec = 0;
		//System.out.println(Arrays.toString(arr));
		Stack<Integer> st = new Stack<Integer>();
		for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		}
		if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		}
	}
} Main public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] arr = line.split(" ");
		int first = 0;
		int sec = 0;
		//System.out.println(Arrays.toString(arr));
		Stack<Integer> st = new Stack<Integer>();
		for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		}
		if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] arr = line.split(" ");
		int first = 0;
		int sec = 0;
		//System.out.println(Arrays.toString(arr));
		Stack<Integer> st = new Stack<Integer>();
		for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		}
		if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] arr = line.split(" "); arr line.split(" ") line.split line " " int first = 0; first 0 int sec = 0; sec 0 Stack<Integer> st = new Stack<Integer>(); st new Stack<Integer>() for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		} {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		} try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			} catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			} Exception e {
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			} if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				} arr[i].equals("+") arr[i].equals arr[i] arr i "+" {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				} sec = st.pop() sec st.pop() st.pop st first = st.pop() first st.pop() st.pop st st.push(first + sec) st.push st first + sec first sec if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				} arr[i].equals("-") arr[i].equals arr[i] arr i "-" {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				} sec = st.pop() sec st.pop() st.pop st first = st.pop() first st.pop() st.pop st st.push(first - sec) st.push st first - sec first sec if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				} arr[i].equals("*") arr[i].equals arr[i] arr i "*" {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				} sec = st.pop() sec st.pop() st.pop st first = st.pop() first st.pop() st.pop st st.push(first * sec) st.push st first * sec first sec {
				st.push(Integer.parseInt(arr[i]));
			} st.push(Integer.parseInt(arr[i])) st.push st Integer.parseInt(arr[i]) Integer.parseInt Integer arr[i] arr i if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		} arr[arr.length-1].equals("+") arr[arr.length-1].equals arr[arr.length-1] arr arr.length-1 arr.length arr arr.length 1 "+" {
			System.out.println(first+sec);
		} System.out.println(first+sec) System.out.println System.out System System.out first+sec first sec if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		} arr[arr.length-1].equals("-") arr[arr.length-1].equals arr[arr.length-1] arr arr.length-1 arr.length arr arr.length 1 "-" {
			System.out.println(first-sec);
		} System.out.println(first-sec) System.out.println System.out System System.out first-sec first sec if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		} arr[arr.length-1].equals("*") arr[arr.length-1].equals arr[arr.length-1] arr arr.length-1 arr.length arr arr.length 1 "*" {
			System.out.println(first*sec);
		} System.out.println(first*sec) System.out.println System.out System System.out first*sec first sec String[] arg arg public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] arr = line.split(" ");
		int first = 0;
		int sec = 0;
		//System.out.println(Arrays.toString(arr));
		Stack<Integer> st = new Stack<Integer>();
		for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		}
		if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		}
	}
} public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] arr = line.split(" ");
		int first = 0;
		int sec = 0;
		//System.out.println(Arrays.toString(arr));
		Stack<Integer> st = new Stack<Integer>();
		for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		}
		if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		}
	}
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] arr = line.split(" ");
		int first = 0;
		int sec = 0;
		//System.out.println(Arrays.toString(arr));
		Stack<Integer> st = new Stack<Integer>();
		for(int i = 0; i < arr.length; i++) {
			try {
				st.push(Integer.parseInt(arr[i]));
			}
			catch(Exception e){
				if(arr[i].equals("+")) {
					sec = st.pop();
					first = st.pop();
					st.push(first + sec);
				}
				else if(arr[i].equals("-")) {
					sec = st.pop();
					first = st.pop();
					st.push(first - sec);
				}
				else if(arr[i].equals("*")) {
					sec = st.pop();
					first = st.pop();
					st.push(first * sec);
				}
			}
		}
		if(arr[arr.length-1].equals("+")) {
			System.out.println(first+sec);
		}
		else if(arr[arr.length-1].equals("-")) {
			System.out.println(first-sec);
		}
		else if(arr[arr.length-1].equals("*")) {
			System.out.println(first*sec);
		}
	}
}

