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

class Stack {
	String[] stack;
	int index;
	public Stack(int size) {
		index = 0;
		stack = new String[size];
	}

	public void put(String target) {
		stack[index++] = target;
	}

	public void put(int target) {
		stack[index++] = String.valueOf(target);
	}

	public String get() {
		return stack[--index];
	}

	public int getNum() {
		return Integer.parseInt(get());

	}
}
public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack stack = new Stack(200);
		String[] strs = br.readLine().split(" ");
		for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		}
		System.out.println(stack.get());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Stack {
	String[] stack;
	int index;
	public Stack(int size) {
		index = 0;
		stack = new String[size];
	}

	public void put(String target) {
		stack[index++] = target;
	}

	public void put(int target) {
		stack[index++] = String.valueOf(target);
	}

	public String get() {
		return stack[--index];
	}

	public int getNum() {
		return Integer.parseInt(get());

	}
} Stack String[] stack; stack int index; index public Stack(int size) {
		index = 0;
		stack = new String[size];
	} Stack {
		index = 0;
		stack = new String[size];
	} index = 0 index 0 stack = new String[size] stack new String[size] size int size size public void put(String target) {
		stack[index++] = target;
	} put {
		stack[index++] = target;
	} stack[index++] = target stack[index++] stack index++ index target String target target public void put(int target) {
		stack[index++] = String.valueOf(target);
	} put {
		stack[index++] = String.valueOf(target);
	} stack[index++] = String.valueOf(target) stack[index++] stack index++ index String.valueOf(target) String.valueOf String target int target target public String get() {
		return stack[--index];
	} get {
		return stack[--index];
	} return stack[--index]; stack[--index] stack --index index public int getNum() {
		return Integer.parseInt(get());

	} getNum {
		return Integer.parseInt(get());

	} return Integer.parseInt(get()); Integer.parseInt(get()) Integer.parseInt Integer get() get public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack stack = new Stack(200);
		String[] strs = br.readLine().split(" ");
		for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		}
		System.out.println(stack.get());
	}
} Main public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack stack = new Stack(200);
		String[] strs = br.readLine().split(" ");
		for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		}
		System.out.println(stack.get());
	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack stack = new Stack(200);
		String[] strs = br.readLine().split(" ");
		for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		}
		System.out.println(stack.get());
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) Stack stack = new Stack(200); stack new Stack(200) String[] strs = br.readLine().split(" "); strs br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		} String target strs {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		} {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		} if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			} "*".equals(target) "*".equals "*" target {
			stack.put(stack.getNum() * stack.getNum());
			} stack.put(stack.getNum() * stack.getNum()) stack.put stack stack.getNum() * stack.getNum() stack.getNum() stack.getNum stack stack.getNum() stack.getNum stack if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			} "+".equals(target) "+".equals "+" target {
				stack.put(stack.getNum() + stack.getNum());
			} stack.put(stack.getNum() + stack.getNum()) stack.put stack stack.getNum() + stack.getNum() stack.getNum() stack.getNum stack stack.getNum() stack.getNum stack if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			} "-".equals(target) "-".equals "-" target {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} int b = stack.getNum(); b stack.getNum() stack.getNum stack int a = stack.getNum(); a stack.getNum() stack.getNum stack stack.put(a - b) stack.put stack a - b a b {
				stack.put(target);
			} stack.put(target) stack.put stack target System.out.println(stack.get()) System.out.println System.out System System.out stack.get() stack.get stack String[] args args public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack stack = new Stack(200);
		String[] strs = br.readLine().split(" ");
		for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		}
		System.out.println(stack.get());
	}
} public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack stack = new Stack(200);
		String[] strs = br.readLine().split(" ");
		for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		}
		System.out.println(stack.get());
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Stack {
	String[] stack;
	int index;
	public Stack(int size) {
		index = 0;
		stack = new String[size];
	}

	public void put(String target) {
		stack[index++] = target;
	}

	public void put(int target) {
		stack[index++] = String.valueOf(target);
	}

	public String get() {
		return stack[--index];
	}

	public int getNum() {
		return Integer.parseInt(get());

	}
}
public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack stack = new Stack(200);
		String[] strs = br.readLine().split(" ");
		for (String target : strs) {
			if ("*".equals(target)) {
			stack.put(stack.getNum() * stack.getNum());
			} else if ("+".equals(target)) {
				stack.put(stack.getNum() + stack.getNum());
			} else if ("-".equals(target)) {
				int b = stack.getNum();
				int a = stack.getNum();
				stack.put(a - b);
			} else {
				stack.put(target);
			}
		}
		System.out.println(stack.get());
	}
}