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

public class Main {
	
	String[] stack = new String[1000000];
	int top = 0;
	
	void run() throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split(" ");
		int result = 0;
		for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		}
		System.out.println(result);
	}
	
	void push(String x) {
		top++;
		stack[top] = x;
	}
	
	String pop() {
		String x = stack[top];
		top--;
		return x;
	}
	
	int calc(String optor, int x , int y) {

		int result = 0;
		switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	
	String[] stack = new String[1000000];
	int top = 0;
	
	void run() throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split(" ");
		int result = 0;
		for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		}
		System.out.println(result);
	}
	
	void push(String x) {
		top++;
		stack[top] = x;
	}
	
	String pop() {
		String x = stack[top];
		top--;
		return x;
	}
	
	int calc(String optor, int x , int y) {

		int result = 0;
		switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} Main String[] stack = new String[1000000]; stack new String[1000000] 1000000 int top = 0; top 0 void run() throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split(" ");
		int result = 0;
		for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		}
		System.out.println(result);
	} run {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split(" ");
		int result = 0;
		for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		}
		System.out.println(result);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] stringArray = br.readLine().split(" "); stringArray br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int result = 0; result 0 for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		} int i = 0; int i = 0; i 0 i < stringArray.length i stringArray.length stringArray stringArray.length i++ i++ i {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		} {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		} if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			} stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/") stringArray[i].equals("*") stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/") stringArray[i].equals("+") stringArray[i].equals stringArray[i] stringArray i "+" stringArray[i].equals("-") stringArray[i].equals stringArray[i] stringArray i "-" stringArray[i].equals("*") stringArray[i].equals stringArray[i] stringArray i "*" stringArray[i].equals("/") stringArray[i].equals stringArray[i] stringArray i "/" {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} int x = Integer.parseInt(pop()); x Integer.parseInt(pop()) Integer.parseInt Integer pop() pop int y = Integer.parseInt(pop()); y Integer.parseInt(pop()) Integer.parseInt Integer pop() pop result = calc(stringArray[i], y ,x) result calc(stringArray[i], y ,x) calc stringArray[i] stringArray i y x push(String.valueOf(result)) push String.valueOf(result) String.valueOf String result {
				push(stringArray[i]);
			} push(stringArray[i]) push stringArray[i] stringArray i System.out.println(result) System.out.println System.out System System.out result void push(String x) {
		top++;
		stack[top] = x;
	} push {
		top++;
		stack[top] = x;
	} top++ top stack[top] = x stack[top] stack top x String x x String pop() {
		String x = stack[top];
		top--;
		return x;
	} pop {
		String x = stack[top];
		top--;
		return x;
	} String x = stack[top]; x stack[top] stack top top-- top return x; x int calc(String optor, int x , int y) {

		int result = 0;
		switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		}
		return result;
	} calc {

		int result = 0;
		switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		}
		return result;
	} int result = 0; result 0 switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		} optor case "+" : "+" case "+" : result = x + y result x + y x y break; case "-": "-" case "-": result = x - y result x - y x y break; case "*": "*" case "*": result = x * y result x * y x y break; case "/": "/" case "/": result = x / y result x / y x y break; return result; result String optor optor int x x int y y public static void main(String[] args) throws IOException {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	
	String[] stack = new String[1000000];
	int top = 0;
	
	void run() throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split(" ");
		int result = 0;
		for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		}
		System.out.println(result);
	}
	
	void push(String x) {
		top++;
		stack[top] = x;
	}
	
	String pop() {
		String x = stack[top];
		top--;
		return x;
	}
	
	int calc(String optor, int x , int y) {

		int result = 0;
		switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} public class Main {
	
	String[] stack = new String[1000000];
	int top = 0;
	
	void run() throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split(" ");
		int result = 0;
		for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		}
		System.out.println(result);
	}
	
	void push(String x) {
		top++;
		stack[top] = x;
	}
	
	String pop() {
		String x = stack[top];
		top--;
		return x;
	}
	
	int calc(String optor, int x , int y) {

		int result = 0;
		switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	String[] stack = new String[1000000];
	int top = 0;
	
	void run() throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split(" ");
		int result = 0;
		for (int i = 0; i < stringArray.length; i++) {
			
			if (stringArray[i].equals("+") ||
				stringArray[i].equals("-") ||	
				stringArray[i].equals("*") ||
				stringArray[i].equals("/")) {
				
				int x = Integer.parseInt(pop());
				int y = Integer.parseInt(pop());
				result = calc(stringArray[i], y ,x);
				push(String.valueOf(result));
			} else {
				push(stringArray[i]);
			}
		}
		System.out.println(result);
	}
	
	void push(String x) {
		top++;
		stack[top] = x;
	}
	
	String pop() {
		String x = stack[top];
		top--;
		return x;
	}
	
	int calc(String optor, int x , int y) {

		int result = 0;
		switch (optor) {
			case "+" :
				result = x + y;
				break;
			case "-":
				result = x - y;
				break;
			case "*":
				result = x * y;
				break;
			case "/":
				result = x / y;
				break;
		}
		return result;
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
}