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

public class Main {

	public static int Oper(ArrayList<String> in) {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	}
	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	public static int Oper(ArrayList<String> in) {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	}
	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	}

} Main public static int Oper(ArrayList<String> in) {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	} Oper {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	} String operators = "+-*/"; operators "+-*/" Stack<String> stack = new Stack<String>(); stack new Stack<String>() for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		} int i = 0; int i = 0; i 0 i < in.size() i in.size() in.size in i++ i++ i {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		} {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		} if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			} !operators.contains(in.get(i)) operators.contains(in.get(i)) operators.contains operators in.get(i) in.get in i {
				stack.push(in.get(i));
			} stack.push(in.get(i)) stack.push stack in.get(i) in.get in i {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			} int y = Integer.parseInt(stack.pop()); y Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack int x= Integer.parseInt(stack.pop()); x Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack int action = operators.indexOf(in.get(i)); action operators.indexOf(in.get(i)) operators.indexOf operators in.get(i) in.get in i if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				} action == 0 action 0 {
					stack.push(String.valueOf(x+y));
				} stack.push(String.valueOf(x+y)) stack.push stack String.valueOf(x+y) String.valueOf String x+y x y if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				} action == 1 action 1 {
					stack.push(String.valueOf(x-y));
				} stack.push(String.valueOf(x-y)) stack.push stack String.valueOf(x-y) String.valueOf String x-y x y if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				} action == 2 action 2 {
					stack.push(String.valueOf(x*y));
				} stack.push(String.valueOf(x*y)) stack.push stack String.valueOf(x*y) String.valueOf String x*y x y if (action == 3) {
					stack.push(String.valueOf(x/y));
				} action == 3 action 3 {
					stack.push(String.valueOf(x/y));
				} stack.push(String.valueOf(x/y)) stack.push stack String.valueOf(x/y) String.valueOf String x/y x y return Integer.parseInt(stack.pop()); Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack ArrayList<String> in in public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	} main {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	} Scanner scan= new Scanner(System.in); scan new Scanner(System.in) ArrayList<String> ARRRAY = new ArrayList<>(); ARRRAY new ArrayList<>() while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		} scan.hasNext() scan.hasNext scan {
			ARRRAY.add(scan.next().trim());
		} ARRRAY.add(scan.next().trim()) ARRRAY.add ARRRAY scan.next().trim() scan.next().trim scan.next() scan.next scan System.out.println(Oper(ARRRAY)) System.out.println System.out System System.out Oper(ARRRAY) Oper ARRRAY scan.close() scan.close scan String[] args args public class Main {

	public static int Oper(ArrayList<String> in) {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	}
	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	}

} public class Main {

	public static int Oper(ArrayList<String> in) {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	}
	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	}

} Main
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static int Oper(ArrayList<String> in) {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	}
	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	}

}
