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

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Stack<Integer> pol = new Stack<Integer>();
		String start = in.nextLine();
		Scanner in2 = new Scanner(start);
		int total = 0;
		while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		}
		System.out.println(total);
		in.close();
		in2.close();
	}
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Stack<Integer> pol = new Stack<Integer>();
		String start = in.nextLine();
		Scanner in2 = new Scanner(start);
		int total = 0;
		while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		}
		System.out.println(total);
		in.close();
		in2.close();
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Stack<Integer> pol = new Stack<Integer>();
		String start = in.nextLine();
		Scanner in2 = new Scanner(start);
		int total = 0;
		while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		}
		System.out.println(total);
		in.close();
		in2.close();
	} main {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Stack<Integer> pol = new Stack<Integer>();
		String start = in.nextLine();
		Scanner in2 = new Scanner(start);
		int total = 0;
		while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		}
		System.out.println(total);
		in.close();
		in2.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) Stack<Integer> pol = new Stack<Integer>(); pol new Stack<Integer>() String start = in.nextLine(); start in.nextLine() in.nextLine in Scanner in2 = new Scanner(start); in2 new Scanner(start) int total = 0; total 0 while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		} in2.hasNext() in2.hasNext in2 {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		} if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			} in2.hasNextInt() in2.hasNextInt in2 {
				pol.push(in2.nextInt());
			} pol.push(in2.nextInt()) pol.push pol in2.nextInt() in2.nextInt in2 {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			} String op = in2.next(); op in2.next() in2.next in2 if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				} op.equals("+") op.equals op "+" {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} int second = pol.pop(); second pol.pop() pol.pop pol int first = pol.pop(); first pol.pop() pol.pop pol total = first + second total first + second first second pol.push(total) pol.push pol total if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				} op.equals("-") op.equals op "-" {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} int second = pol.pop(); second pol.pop() pol.pop pol int first = pol.pop(); first pol.pop() pol.pop pol total = first - second total first - second first second pol.push(total) pol.push pol total if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				} op.equals("*") op.equals op "*" {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} int second = pol.pop(); second pol.pop() pol.pop pol int first = pol.pop(); first pol.pop() pol.pop pol total = first * second total first * second first second pol.push(total) pol.push pol total if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				} op.equals("/") op.equals op "/" {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				} int second = pol.pop(); second pol.pop() pol.pop pol int first = pol.pop(); first pol.pop() pol.pop pol total = first / second total first / second first second pol.push(total) pol.push pol total System.out.println(total) System.out.println System.out System System.out total in.close() in.close in in2.close() in2.close in2 String[] args args public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Stack<Integer> pol = new Stack<Integer>();
		String start = in.nextLine();
		Scanner in2 = new Scanner(start);
		int total = 0;
		while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		}
		System.out.println(total);
		in.close();
		in2.close();
	}
} public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Stack<Integer> pol = new Stack<Integer>();
		String start = in.nextLine();
		Scanner in2 = new Scanner(start);
		int total = 0;
		while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		}
		System.out.println(total);
		in.close();
		in2.close();
	}
} Main

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

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Stack<Integer> pol = new Stack<Integer>();
		String start = in.nextLine();
		Scanner in2 = new Scanner(start);
		int total = 0;
		while(in2.hasNext()) {
			if(in2.hasNextInt()) {
				pol.push(in2.nextInt());
			} else {
				String op = in2.next();
				if(op.equals("+")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first + second;
					pol.push(total);
				} else if(op.equals("-")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first - second;
					pol.push(total);
				} else if(op.equals("*")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first * second;
					pol.push(total);
				} else if(op.equals("/")) {
					int second = pol.pop();
					int first = pol.pop();
					total = first / second;
					pol.push(total);
				}
			}
		}
		System.out.println(total);
		in.close();
		in2.close();
	}
}

