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

public class Main {

	private static class Stack {

		private int [] data;
		private int top;

		// ????????????Stack stack = new Stack(?????????????????????);???
		public Stack(int stackSize) {
			this.data = new int[stackSize];
			this.top = 0;
		}

		// ?????????????????????????????????????????????
		// ????????????
		// stack.push(?????????);
		public void push(int pushData) {
			this.data[this.top] = pushData;
			this.top++;
		}

		// ??????????????????????????????????????????????????????
		// ????????????
		// int data = stack.pop();
		public int pop() {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] formula = br.readLine().split(" ");

		Stack stack = new Stack(100);

		for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		}
		System.out.println(stack.pop());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	private static class Stack {

		private int [] data;
		private int top;

		// ????????????Stack stack = new Stack(?????????????????????);???
		public Stack(int stackSize) {
			this.data = new int[stackSize];
			this.top = 0;
		}

		// ?????????????????????????????????????????????
		// ????????????
		// stack.push(?????????);
		public void push(int pushData) {
			this.data[this.top] = pushData;
			this.top++;
		}

		// ??????????????????????????????????????????????????????
		// ????????????
		// int data = stack.pop();
		public int pop() {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] formula = br.readLine().split(" ");

		Stack stack = new Stack(100);

		for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		}
		System.out.println(stack.pop());
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] formula = br.readLine().split(" ");

		Stack stack = new Stack(100);

		for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		}
		System.out.println(stack.pop());
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] formula = br.readLine().split(" ");

		Stack stack = new Stack(100);

		for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		}
		System.out.println(stack.pop());
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] formula = br.readLine().split(" "); formula br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " Stack stack = new Stack(100); stack new Stack(100) for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		} int i = 0; int i = 0; i 0 i < formula.length i formula.length formula formula.length i++ i++ i {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		} {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		} if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			} !formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*") !formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*") !formula[i].equals("+") formula[i].equals("+") formula[i].equals formula[i] formula i "+" !formula[i].equals("-") formula[i].equals("-") formula[i].equals formula[i] formula i "-" !formula[i].equals("*") formula[i].equals("*") formula[i].equals formula[i] formula i "*" {
				stack.push(Integer.parseInt(formula[i]));
			} stack.push(Integer.parseInt(formula[i])) stack.push stack Integer.parseInt(formula[i]) Integer.parseInt Integer formula[i] formula i {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			} if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				} formula[i].equals("+") formula[i].equals formula[i] formula i "+" {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} int popNum1 = stack.pop(); popNum1 stack.pop() stack.pop stack int popNum2 = stack.pop(); popNum2 stack.pop() stack.pop stack int formulaResult = popNum2 + popNum1; formulaResult popNum2 + popNum1 popNum2 popNum1 stack.push(formulaResult) stack.push stack formulaResult if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				} formula[i].equals("-") formula[i].equals formula[i] formula i "-" {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} int popNum1 = stack.pop(); popNum1 stack.pop() stack.pop stack int popNum2 = stack.pop(); popNum2 stack.pop() stack.pop stack int formulaResult = popNum2 - popNum1; formulaResult popNum2 - popNum1 popNum2 popNum1 stack.push(formulaResult) stack.push stack formulaResult if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				} formula[i].equals("*") formula[i].equals formula[i] formula i "*" {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				} int popNum1 = stack.pop(); popNum1 stack.pop() stack.pop stack int popNum2 = stack.pop(); popNum2 stack.pop() stack.pop stack int formulaResult = popNum2 * popNum1; formulaResult popNum2 * popNum1 popNum2 popNum1 stack.push(formulaResult) stack.push stack formulaResult System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args private static class Stack {

		private int [] data;
		private int top;

		// ????????????Stack stack = new Stack(?????????????????????);???
		public Stack(int stackSize) {
			this.data = new int[stackSize];
			this.top = 0;
		}

		// ?????????????????????????????????????????????
		// ????????????
		// stack.push(?????????);
		public void push(int pushData) {
			this.data[this.top] = pushData;
			this.top++;
		}

		// ??????????????????????????????????????????????????????
		// ????????????
		// int data = stack.pop();
		public int pop() {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		}
	} Stack private int [] data; data private int top; top // ????????????Stack stack = new Stack(?????????????????????);???
		public Stack(int stackSize) {
			this.data = new int[stackSize];
			this.top = 0;
		} Stack {
			this.data = new int[stackSize];
			this.top = 0;
		} this.data = new int[stackSize] this.data this this.data new int[stackSize] stackSize this.top = 0 this.top this this.top 0 int stackSize stackSize // ?????????????????????????????????????????????
		// ????????????
		// stack.push(?????????);
		public void push(int pushData) {
			this.data[this.top] = pushData;
			this.top++;
		} push {
			this.data[this.top] = pushData;
			this.top++;
		} this.data[this.top] = pushData this.data[this.top] this.data this this.data this.top this this.top pushData this.top++ this.top this this.top int pushData pushData // ??????????????????????????????????????????????????????
		// ????????????
		// int data = stack.pop();
		public int pop() {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		} pop {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		} this.top-- this.top this this.top int popData = this.data[this.top]; popData this.data[this.top] this.data this this.data this.top this this.top return popData; popData public class Main {

	private static class Stack {

		private int [] data;
		private int top;

		// ????????????Stack stack = new Stack(?????????????????????);???
		public Stack(int stackSize) {
			this.data = new int[stackSize];
			this.top = 0;
		}

		// ?????????????????????????????????????????????
		// ????????????
		// stack.push(?????????);
		public void push(int pushData) {
			this.data[this.top] = pushData;
			this.top++;
		}

		// ??????????????????????????????????????????????????????
		// ????????????
		// int data = stack.pop();
		public int pop() {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] formula = br.readLine().split(" ");

		Stack stack = new Stack(100);

		for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		}
		System.out.println(stack.pop());
	}
} public class Main {

	private static class Stack {

		private int [] data;
		private int top;

		// ????????????Stack stack = new Stack(?????????????????????);???
		public Stack(int stackSize) {
			this.data = new int[stackSize];
			this.top = 0;
		}

		// ?????????????????????????????????????????????
		// ????????????
		// stack.push(?????????);
		public void push(int pushData) {
			this.data[this.top] = pushData;
			this.top++;
		}

		// ??????????????????????????????????????????????????????
		// ????????????
		// int data = stack.pop();
		public int pop() {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] formula = br.readLine().split(" ");

		Stack stack = new Stack(100);

		for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		}
		System.out.println(stack.pop());
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	private static class Stack {

		private int [] data;
		private int top;

		// ????????????Stack stack = new Stack(?????????????????????);???
		public Stack(int stackSize) {
			this.data = new int[stackSize];
			this.top = 0;
		}

		// ?????????????????????????????????????????????
		// ????????????
		// stack.push(?????????);
		public void push(int pushData) {
			this.data[this.top] = pushData;
			this.top++;
		}

		// ??????????????????????????????????????????????????????
		// ????????????
		// int data = stack.pop();
		public int pop() {
			this.top--;
			int popData = this.data[this.top];

			return popData;
		}
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] formula = br.readLine().split(" ");

		Stack stack = new Stack(100);

		for(int i = 0; i < formula.length; i++) {
			if(!formula[i].equals("+") && !formula[i].equals("-") && !formula[i].equals("*")) {
				stack.push(Integer.parseInt(formula[i]));
			} else {
				if(formula[i].equals("+")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 + popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("-")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 - popNum1;

					stack.push(formulaResult);
				} else if(formula[i].equals("*")) {
					int popNum1 = stack.pop();
					int popNum2 = stack.pop();

					int formulaResult = popNum2 * popNum1;

					stack.push(formulaResult);
				}
			}
		}
		System.out.println(stack.pop());
	}
}