
import java.util.Stack;
import java.util.Scanner;

public class Main{
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		String[] tokenStrings = scan.nextLine().split(" ");
		scan.close();
		Stack<Integer> tokens = new Stack<Integer>();
		for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		}

		int answer = tokens.pop();
		System.out.println(answer);
	}
}
 import java.util.Stack; Stack java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		String[] tokenStrings = scan.nextLine().split(" ");
		scan.close();
		Stack<Integer> tokens = new Stack<Integer>();
		for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		}

		int answer = tokens.pop();
		System.out.println(answer);
	}
} Main public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		String[] tokenStrings = scan.nextLine().split(" ");
		scan.close();
		Stack<Integer> tokens = new Stack<Integer>();
		for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		}

		int answer = tokens.pop();
		System.out.println(answer);
	} main {
		Scanner scan = new Scanner(System.in);
		String[] tokenStrings = scan.nextLine().split(" ");
		scan.close();
		Stack<Integer> tokens = new Stack<Integer>();
		for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		}

		int answer = tokens.pop();
		System.out.println(answer);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String[] tokenStrings = scan.nextLine().split(" "); tokenStrings scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " scan.close() scan.close scan Stack<Integer> tokens = new Stack<Integer>(); tokens new Stack<Integer>() for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		} int i = 0; int i = 0; i 0 i < tokenStrings.length i tokenStrings.length tokenStrings tokenStrings.length i++ i++ i {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		} {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		} String token = tokenStrings[i]; token tokenStrings[i] tokenStrings i if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token)); token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-") token.equals("+") token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-") token.equals("*") token.equals token "*" token.equals("/") token.equals token "/" token.equals("+") token.equals token "+" token.equals("-") token.equals token "-" {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			} int operand1 = tokens.pop(); operand1 tokens.pop() tokens.pop tokens int operand2 = tokens.pop(); operand2 tokens.pop() tokens.pop tokens if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1); token.equals("*") token.equals token "*" tokens.push(operand2 * operand1) tokens.push tokens operand2 * operand1 operand2 operand1 if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1); token.equals("/") token.equals token "/" tokens.push(operand2 / operand1) tokens.push tokens operand2 / operand1 operand2 operand1 if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1); token.equals("+") token.equals token "+" tokens.push(operand2 + operand1) tokens.push tokens operand2 + operand1 operand2 operand1 tokens.push(operand2 - operand1) tokens.push tokens operand2 - operand1 operand2 operand1 tokens.push(Integer.parseInt(token)) tokens.push tokens Integer.parseInt(token) Integer.parseInt Integer token int answer = tokens.pop(); answer tokens.pop() tokens.pop tokens System.out.println(answer) System.out.println System.out System System.out answer String [] args args public class Main{
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		String[] tokenStrings = scan.nextLine().split(" ");
		scan.close();
		Stack<Integer> tokens = new Stack<Integer>();
		for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		}

		int answer = tokens.pop();
		System.out.println(answer);
	}
} public class Main{
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		String[] tokenStrings = scan.nextLine().split(" ");
		scan.close();
		Stack<Integer> tokens = new Stack<Integer>();
		for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		}

		int answer = tokens.pop();
		System.out.println(answer);
	}
} Main

import java.util.Stack;
import java.util.Scanner;

public class Main{
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		String[] tokenStrings = scan.nextLine().split(" ");
		scan.close();
		Stack<Integer> tokens = new Stack<Integer>();
		for(int i = 0; i < tokenStrings.length; i++) {
			String token = tokenStrings[i];
			if(token.equals("*") || token.equals("/") || token.equals("+") || token.equals("-")) {
				int operand1 = tokens.pop();
				int operand2 = tokens.pop();
				if(token.equals("*"))
					tokens.push(operand2 * operand1);
				else if(token.equals("/"))
					tokens.push(operand2 / operand1);
				else if(token.equals("+"))
					tokens.push(operand2 + operand1);
				else
					tokens.push(operand2 - operand1);
			}
			else
				tokens.push(Integer.parseInt(token));
			
		}

		int answer = tokens.pop();
		System.out.println(answer);
	}
}

