import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		String[] line =n.split(" ");


		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		}
        int ans = stack.pop();
		System.out.println(ans);
	}
}

 import java.util.ArrayDeque; ArrayDeque java.util import java.util.Deque; Deque java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		String[] line =n.split(" ");


		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		}
        int ans = stack.pop();
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		String[] line =n.split(" ");


		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		}
        int ans = stack.pop();
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		String[] line =n.split(" ");


		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		}
        int ans = stack.pop();
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.nextLine(); n sc.nextLine() sc.nextLine sc String[] line =n.split(" "); line n.split(" ") n.split n " " Deque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		} int i=0; int i=0; i 0 i<line.length i line.length line line.length i++ i++ i {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		} {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		} int a=0 a 0 b=0; b 0 switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			} line[i] line i case "+": "+" case "+": a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b+a) stack.push stack b+a b a break; case "-": "-" case "-": a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b-a) stack.push stack b-a b a break; case "/": "/" case "/": a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b/a) stack.push stack b/a b a break; case "*": "*" case "*": a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b*a) stack.push stack b*a b a break; default: default: a = Integer.parseInt(line[i]) a Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i stack.push(a) stack.push stack a break; int ans = stack.pop(); ans stack.pop() stack.pop stack System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		String[] line =n.split(" ");


		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		}
        int ans = stack.pop();
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		String[] line =n.split(" ");


		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		}
        int ans = stack.pop();
		System.out.println(ans);
	}
} Main
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();

		String[] line =n.split(" ");


		Deque<Integer> stack = new ArrayDeque<Integer>();
		for(int i=0; i<line.length; i++) {
			int a=0,b=0;
			switch(line[i]) {
			case "+":
				a = stack.pop();
				b = stack.pop();
				stack.push(b+a);
				break;
			case "-":
				a = stack.pop();
				b = stack.pop();
				stack.push(b-a);
				break;
			case "/":
				a = stack.pop();
				b = stack.pop();
				stack.push(b/a);
				break;
			case "*":
				a = stack.pop();
				b = stack.pop();
				stack.push(b*a);
				break;
			default:
				a = Integer.parseInt(line[i]);
				stack.push(a);
				break; 
			}
		}
        int ans = stack.pop();
		System.out.println(ans);
	}
}


