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 pointer = 0, result, operand2, operand1,
			strToIntData;

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

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

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

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

			if (tempStrData.equals("+")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 + operand1;
				push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			}
		}
		return 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));
		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 pointer = 0, result, operand2, operand1,
			strToIntData;

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

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

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

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

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

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

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

			if (tempStrData.equals("+")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 + operand1;
				push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				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 = pop();
				operand2 = pop();
				result = operand2 + operand1;
				push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			}
		} {
			tempStrData = readData[i];

			if (tempStrData.equals("+")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 + operand1;
				push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			}
		} tempStrData = readData[i] tempStrData readData[i] readData i if (tempStrData.equals("+")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 + operand1;
				push(result);
			} else if (tempStrData.equals("-")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			} tempStrData.equals("+") tempStrData.equals tempStrData "+" {
				operand1 = pop();
				operand2 = pop();
				result = operand2 + operand1;
				push(result);
			} operand1 = pop() operand1 pop() pop operand2 = pop() operand2 pop() pop result = operand2 + operand1 result operand2 + operand1 operand2 operand1 push(result) push result if (tempStrData.equals("-")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} else if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			} tempStrData.equals("-") tempStrData.equals tempStrData "-" {
				operand1 = pop();
				operand2 = pop();
				result = operand2 - operand1;
				push(result);
			} operand1 = pop() operand1 pop() pop operand2 = pop() operand2 pop() pop result = operand2 - operand1 result operand2 - operand1 operand2 operand1 push(result) push result if (tempStrData.equals("*")) {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} else {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			} tempStrData.equals("*") tempStrData.equals tempStrData "*" {
				operand1 = pop();
				operand2 = pop();
				result = operand2 * operand1;
				push(result);
			} operand1 = pop() operand1 pop() pop operand2 = pop() operand2 pop() pop result = operand2 * operand1 result operand2 * operand1 operand2 operand1 push(result) push result {
				strToIntData = Integer.parseInt(readData[i]);
				push(strToIntData);
			} strToIntData = Integer.parseInt(readData[i]) strToIntData Integer.parseInt(readData[i]) Integer.parseInt Integer readData[i] readData i push(strToIntData) push strToIntData return pop(); pop() pop 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 pointer = 0, result, operand2, operand1,
			strToIntData;

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

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

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

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

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