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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	}
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int sum = 0; sum 0 String[] array = scan.nextLine().split(" "); array scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " Stack<String> stack = new Stack<>(); stack new Stack<>() for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		} {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		} try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    } catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    } NumberFormatException e {
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    } int x = Integer.parseInt(stack.pop()); x Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack int y = Integer.parseInt(stack.pop()); y Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					} array[i].equals("+") array[i].equals array[i] array i "+" {
					stack.push(String.valueOf(y+x));
				} stack.push(String.valueOf(y+x)) stack.push stack String.valueOf(y+x) String.valueOf String y+x y x if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					} array[i].equals("-") array[i].equals array[i] array i "-" {
					stack.push(String.valueOf(y-x));
					} stack.push(String.valueOf(y-x)) stack.push stack String.valueOf(y-x) String.valueOf String y-x y x if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					} array[i].equals("*") array[i].equals array[i] array i "*" {
						stack.push(String.valueOf(y*x));
					} stack.push(String.valueOf(y*x)) stack.push stack String.valueOf(y*x) String.valueOf String y*x y x if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					} array[i].equals("/") array[i].equals array[i] array i "/" {
						stack.push(String.valueOf(y/x));
					} stack.push(String.valueOf(y/x)) stack.push stack String.valueOf(y/x) String.valueOf String y/x y x {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			} stack.push(String.valueOf(Integer.parseInt(array[i]))) stack.push stack String.valueOf(Integer.parseInt(array[i])) String.valueOf String Integer.parseInt(array[i]) Integer.parseInt Integer array[i] array i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	}
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		String[] array = scan.nextLine().split(" ");
		Stack<String> stack = new Stack<>();
		
		for(int i = 0; i < array.length; i++) {
			try {
				stack.push(String.valueOf(Integer.parseInt(array[i])));
			
			
			}catch(NumberFormatException e){
				int x = Integer.parseInt(stack.pop());
				int y = Integer.parseInt(stack.pop());
		           
				if(array[i].equals("+")) {
					stack.push(String.valueOf(y+x));
				} else if(array[i].equals("-")) {
					stack.push(String.valueOf(y-x));
					} else if(array[i].equals("*")) {
						stack.push(String.valueOf(y*x));
					} else if(array[i].equals("/")) {
						stack.push(String.valueOf(y/x));
					}
		    }    
			//System.out.println(stack);
		}
		System.out.println(stack.pop());
	}
}
