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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackControler readDataArr = new StackControler(in.readLine()
				.split(" "));
		System.out.println(readDataArr.calcData());
	}
}

class Stack {
	private int[] stack;
	private static int pointer = 0;

	Stack(int[] stack) {
		this.stack = stack;
	}

	public void push(int data) {
		stack[pointer] = data;
		pointer++;
	}

	public int pop() {
		pointer--;
		return stack[pointer];
	}

}

class StackControler {
	private Stack stack;
	private String[] readData;
	private int operand2, operand1, result, strToIntData;

	StackControler(String[] readData) {
		this.readData = readData;
	}

	public int calcData() {
		String tempStrData;
		stack = new Stack(new int[100]);
		for (int i = 0; i < readData.length; i++) {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		}
		return 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 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackControler readDataArr = new StackControler(in.readLine()
				.split(" "));
		System.out.println(readDataArr.calcData());
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackControler readDataArr = new StackControler(in.readLine()
				.split(" "));
		System.out.println(readDataArr.calcData());
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackControler readDataArr = new StackControler(in.readLine()
				.split(" "));
		System.out.println(readDataArr.calcData());
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) StackControler readDataArr = new StackControler(in.readLine()
				.split(" ")); readDataArr new StackControler(in.readLine()
				.split(" ")) System.out.println(readDataArr.calcData()) System.out.println System.out System System.out readDataArr.calcData() readDataArr.calcData readDataArr String[] args args class Stack {
	private int[] stack;
	private static int pointer = 0;

	Stack(int[] stack) {
		this.stack = stack;
	}

	public void push(int data) {
		stack[pointer] = data;
		pointer++;
	}

	public int pop() {
		pointer--;
		return stack[pointer];
	}

} Stack private int[] stack; stack private static int pointer = 0; pointer 0 Stack(int[] stack) {
		this.stack = stack;
	} Stack {
		this.stack = stack;
	} this.stack = stack this.stack this this.stack stack int[] stack stack public void push(int data) {
		stack[pointer] = data;
		pointer++;
	} push {
		stack[pointer] = data;
		pointer++;
	} stack[pointer] = data stack[pointer] stack pointer data pointer++ pointer int data data public int pop() {
		pointer--;
		return stack[pointer];
	} pop {
		pointer--;
		return stack[pointer];
	} pointer-- pointer return stack[pointer]; stack[pointer] stack pointer class StackControler {
	private Stack stack;
	private String[] readData;
	private int operand2, operand1, result, strToIntData;

	StackControler(String[] readData) {
		this.readData = readData;
	}

	public int calcData() {
		String tempStrData;
		stack = new Stack(new int[100]);
		for (int i = 0; i < readData.length; i++) {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		}
		return stack.pop();
	}
} StackControler private Stack stack; stack private String[] readData; readData private int operand2 operand2 operand1 operand1 result result strToIntData; strToIntData StackControler(String[] readData) {
		this.readData = readData;
	} StackControler {
		this.readData = readData;
	} this.readData = readData this.readData this this.readData readData String[] readData readData public int calcData() {
		String tempStrData;
		stack = new Stack(new int[100]);
		for (int i = 0; i < readData.length; i++) {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		}
		return stack.pop();
	} calcData {
		String tempStrData;
		stack = new Stack(new int[100]);
		for (int i = 0; i < readData.length; i++) {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		}
		return stack.pop();
	} String tempStrData; tempStrData stack = new Stack(new int[100]) stack new Stack(new int[100]) for (int i = 0; i < readData.length; i++) {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		} int i = 0; int i = 0; i 0 i < readData.length i readData.length readData readData.length i++ i++ i {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		} {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		} tempStrData = readData[i] tempStrData readData[i] readData i if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			} tempStrData.equals("+") tempStrData.equals tempStrData "+" {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} operand1 = stack.pop() operand1 stack.pop() stack.pop stack operand2 = stack.pop() operand2 stack.pop() stack.pop stack result = operand2 + operand1 result operand2 + operand1 operand2 operand1 stack.push(result) stack.push stack result if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			} tempStrData.equals("-") tempStrData.equals tempStrData "-" {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} operand1 = stack.pop() operand1 stack.pop() stack.pop stack operand2 = stack.pop() operand2 stack.pop() stack.pop stack result = operand2 - operand1 result operand2 - operand1 operand2 operand1 stack.push(result) stack.push stack result if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			} tempStrData.equals("*") tempStrData.equals tempStrData "*" {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} operand1 = stack.pop() operand1 stack.pop() stack.pop stack operand2 = stack.pop() operand2 stack.pop() stack.pop stack result = operand2 * operand1 result operand2 * operand1 operand2 operand1 stack.push(result) stack.push stack result {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			} strToIntData = Integer.parseInt(readData[i]) strToIntData Integer.parseInt(readData[i]) Integer.parseInt Integer readData[i] readData i stack.push(strToIntData) stack.push stack strToIntData return stack.pop(); stack.pop() stack.pop stack public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackControler readDataArr = new StackControler(in.readLine()
				.split(" "));
		System.out.println(readDataArr.calcData());
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackControler readDataArr = new StackControler(in.readLine()
				.split(" "));
		System.out.println(readDataArr.calcData());
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackControler readDataArr = new StackControler(in.readLine()
				.split(" "));
		System.out.println(readDataArr.calcData());
	}
}

class Stack {
	private int[] stack;
	private static int pointer = 0;

	Stack(int[] stack) {
		this.stack = stack;
	}

	public void push(int data) {
		stack[pointer] = data;
		pointer++;
	}

	public int pop() {
		pointer--;
		return stack[pointer];
	}

}

class StackControler {
	private Stack stack;
	private String[] readData;
	private int operand2, operand1, result, strToIntData;

	StackControler(String[] readData) {
		this.readData = readData;
	}

	public int calcData() {
		String tempStrData;
		stack = new Stack(new int[100]);
		for (int i = 0; i < readData.length; i++) {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 + operand1;
				stack.push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 - operand1;
				stack.push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = stack.pop();
				operand2 = stack.pop();
				result = operand2 * operand1;
				stack.push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				stack.push(strToIntData);
			}
		}
		return stack.pop();
	}
}