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));
		StackSub readDataArr = new StackSub(in.readLine().split(" "));
		System.out.println(readDataArr.calcData());
	}
}

class StackSub {
	private String[] readData;
	private int[] stack = new int[100];
	private int ans, operand1, operand2, pointer = 0;

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

	public int calcData() {
		char tempCharData;
		for (int i = 0; i < readData.length; i++) {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		}
		ans = stack[0];
		return ans;
	}
} 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));
		StackSub readDataArr = new StackSub(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));
		StackSub readDataArr = new StackSub(in.readLine().split(" "));
		System.out.println(readDataArr.calcData());
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackSub readDataArr = new StackSub(in.readLine().split(" "));
		System.out.println(readDataArr.calcData());
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) StackSub readDataArr = new StackSub(in.readLine().split(" ")); readDataArr new StackSub(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 StackSub {
	private String[] readData;
	private int[] stack = new int[100];
	private int ans, operand1, operand2, pointer = 0;

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

	public int calcData() {
		char tempCharData;
		for (int i = 0; i < readData.length; i++) {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		}
		ans = stack[0];
		return ans;
	}
} StackSub private String[] readData; readData private int[] stack = new int[100]; stack new int[100] 100 private int ans ans operand1 operand1 operand2 operand2 pointer = 0; pointer 0 StackSub(String[] readData) {
		this.readData = readData;
	} StackSub {
		this.readData = readData;
	} this.readData = readData this.readData this this.readData readData String[] readData readData public int calcData() {
		char tempCharData;
		for (int i = 0; i < readData.length; i++) {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		}
		ans = stack[0];
		return ans;
	} calcData {
		char tempCharData;
		for (int i = 0; i < readData.length; i++) {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		}
		ans = stack[0];
		return ans;
	} char tempCharData; tempCharData for (int i = 0; i < readData.length; i++) {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		} int i = 0; int i = 0; i 0 i < readData.length i readData.length readData readData.length i++ i++ i {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		} {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		} tempCharData = readData[i].charAt(0) tempCharData readData[i].charAt(0) readData[i].charAt readData[i] readData i 0 operand1 = pointer - 2 operand1 pointer - 2 pointer 2 operand2 = pointer - 1 operand2 pointer - 1 pointer 1 if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			} tempCharData == '+' tempCharData '+' {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} stack[operand1] = stack[operand1] + stack[operand2] stack[operand1] stack operand1 stack[operand1] + stack[operand2] stack[operand1] stack operand1 stack[operand2] stack operand2 pointer-- pointer if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			} tempCharData == '-' tempCharData '-' {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} stack[operand1] = stack[operand1] - stack[operand2] stack[operand1] stack operand1 stack[operand1] - stack[operand2] stack[operand1] stack operand1 stack[operand2] stack operand2 pointer-- pointer if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			} tempCharData == '*' tempCharData '*' {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} stack[operand1] = stack[operand1] * stack[operand2] stack[operand1] stack operand1 stack[operand1] * stack[operand2] stack[operand1] stack operand1 stack[operand2] stack operand2 pointer-- pointer {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			} stack[pointer] = Integer.parseInt(readData[i]) stack[pointer] stack pointer Integer.parseInt(readData[i]) Integer.parseInt Integer readData[i] readData i pointer++ pointer ans = stack[0] ans stack[0] stack 0 return ans; ans public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StackSub readDataArr = new StackSub(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));
		StackSub readDataArr = new StackSub(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));
		StackSub readDataArr = new StackSub(in.readLine().split(" "));
		System.out.println(readDataArr.calcData());
	}
}

class StackSub {
	private String[] readData;
	private int[] stack = new int[100];
	private int ans, operand1, operand2, pointer = 0;

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

	public int calcData() {
		char tempCharData;
		for (int i = 0; i < readData.length; i++) {
			tempCharData = readData[i].charAt(0);
			operand1 = pointer - 2;
			operand2 = pointer - 1;

			if (tempCharData == '+') {
				stack[operand1] = stack[operand1] + stack[operand2];
				pointer--;
			} else if (tempCharData == '-') {
				stack[operand1] = stack[operand1] - stack[operand2];
				pointer--;
			} else if (tempCharData == '*') {
				stack[operand1] = stack[operand1] * stack[operand2];
				pointer--;
			} else {
				stack[pointer] = Integer.parseInt(readData[i]);
				pointer++;
			}
		}
		ans = stack[0];
		return ans;
	}
}