import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    LinkedList<String> stack = new LinkedList<String>();
		
		try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.LinkedList; LinkedList java.util public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    LinkedList<String> stack = new LinkedList<String>();
		
		try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} Main public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    LinkedList<String> stack = new LinkedList<String>();
		
		try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    LinkedList<String> stack = new LinkedList<String>();
		
		try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) LinkedList<String> stack = new LinkedList<String>(); stack new LinkedList<String>() try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} NumberFormatException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} IOException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} String[] param = in.readLine().split(" "); param in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int i = 0; i 0 while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			} i < param.length i param.length param param.length {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			} while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				} (param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false) (param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false) (param[i].equals("+") == false) param[i].equals("+") param[i].equals param[i] param i "+" false (param[i].equals("-") == false) param[i].equals("-") param[i].equals param[i] param i "-" false (param[i].equals("*") == false) param[i].equals("*") param[i].equals param[i] param i "*" false {
					stack.push(param[i]);
					i++;
				} stack.push(param[i]) stack.push stack param[i] param i i++ i int b = Integer.parseInt(stack.pop()); b Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack int a = Integer.parseInt(stack.pop()); a Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				} param[i].equals("+") param[i].equals param[i] param i "+" {
					stack.push(String.valueOf(a + b));
				} stack.push(String.valueOf(a + b)) stack.push stack String.valueOf(a + b) String.valueOf String a + b a b if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				} param[i].equals("-") param[i].equals param[i] param i "-" {
					stack.push(String.valueOf(a - b));
				} stack.push(String.valueOf(a - b)) stack.push stack String.valueOf(a - b) String.valueOf String a - b a b {
					stack.push(String.valueOf(a * b));
				} stack.push(String.valueOf(a * b)) stack.push stack String.valueOf(a * b) String.valueOf String a * b a b i++ i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    LinkedList<String> stack = new LinkedList<String>();
		
		try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    LinkedList<String> stack = new LinkedList<String>();
		
		try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    LinkedList<String> stack = new LinkedList<String>();
		
		try {
			String[] param = in.readLine().split(" ");
			
			int i = 0;
			while (i < param.length) {
				while ((param[i].equals("+") == false)
						&& (param[i].equals("-") == false) && (param[i].equals("*") == false)) {
					stack.push(param[i]);
					i++;
				}
				int b = Integer.parseInt(stack.pop());
				int a = Integer.parseInt(stack.pop());
				
				if (param[i].equals("+")) {
					stack.push(String.valueOf(a + b));
				} else if (param[i].equals("-")) {
					stack.push(String.valueOf(a - b));
				} else {
					stack.push(String.valueOf(a * b));
				}
				i++;
			}
			
			System.out.println(stack.pop());
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}