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

public class Main {
	public static void main(String[] args) {
		Stack<Integer> myStack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		int a, b;
		while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		}
		System.out.println(myStack.pop());
	}
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
	public static void main(String[] args) {
		Stack<Integer> myStack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		int a, b;
		while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		}
		System.out.println(myStack.pop());
	}
} Main public static void main(String[] args) {
		Stack<Integer> myStack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		int a, b;
		while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		}
		System.out.println(myStack.pop());
	} main {
		Stack<Integer> myStack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		int a, b;
		while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		}
		System.out.println(myStack.pop());
	} Stack<Integer> myStack = new Stack<Integer>(); myStack new Stack<Integer>() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a a b; b while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		} sc.hasNext() sc.hasNext sc {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		} String str = sc.next(); str sc.next() sc.next sc if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			} str.charAt(0) == '+' str.charAt(0) str.charAt str 0 '+' {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			} a = myStack.pop() a myStack.pop() myStack.pop myStack b = myStack.pop() b myStack.pop() myStack.pop myStack myStack.push(b + a) myStack.push myStack b + a b a if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			} str.charAt(0) == '-' str.charAt(0) str.charAt str 0 '-' {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			} a = myStack.pop() a myStack.pop() myStack.pop myStack b = myStack.pop() b myStack.pop() myStack.pop myStack myStack.push(b - a) myStack.push myStack b - a b a if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			} str.charAt(0) == '*' str.charAt(0) str.charAt str 0 '*' {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			} a = myStack.pop() a myStack.pop() myStack.pop myStack b = myStack.pop() b myStack.pop() myStack.pop myStack myStack.push(b * a) myStack.push myStack b * a b a if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			} str.charAt(0) == '/' str.charAt(0) str.charAt str 0 '/' {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			} a = myStack.pop() a myStack.pop() myStack.pop myStack b = myStack.pop() b myStack.pop() myStack.pop myStack myStack.push(b / a) myStack.push myStack b / a b a {
				myStack.push(Integer.parseInt(str));
			} myStack.push(Integer.parseInt(str)) myStack.push myStack Integer.parseInt(str) Integer.parseInt Integer str System.out.println(myStack.pop()) System.out.println System.out System System.out myStack.pop() myStack.pop myStack String[] args args public class Main {
	public static void main(String[] args) {
		Stack<Integer> myStack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		int a, b;
		while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		}
		System.out.println(myStack.pop());
	}
} public class Main {
	public static void main(String[] args) {
		Stack<Integer> myStack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		int a, b;
		while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		}
		System.out.println(myStack.pop());
	}
} Main

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

public class Main {
	public static void main(String[] args) {
		Stack<Integer> myStack = new Stack<Integer>();
		Scanner sc = new Scanner(System.in);
		int a, b;
		while (sc.hasNext()) {
			
			String str = sc.next();
			if (str.charAt(0) == '+') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b + a);
			}
			else if (str.charAt(0) == '-') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b - a);
			}
			else if (str.charAt(0) == '*') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b * a);
			}
			else if (str.charAt(0) == '/') {
				a = myStack.pop();
				b = myStack.pop();
				myStack.push(b / a);
			}
			else {
				myStack.push(Integer.parseInt(str));
			}
		}
		System.out.println(myStack.pop());
	}
}

