import java.util.Scanner;

public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		int top = 0;
		String s;
		int stack[] = new int[101];
		
		while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		}
		scan.close();
		System.out.println(stack[top]);
		
	}
	
	public static boolean isNum( String str) {
		java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$");
		java.util.regex.Matcher matcher
		= pattern.matcher(str);
		
		return matcher.matches();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		int top = 0;
		String s;
		int stack[] = new int[101];
		
		while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		}
		scan.close();
		System.out.println(stack[top]);
		
	}
	
	public static boolean isNum( String str) {
		java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$");
		java.util.regex.Matcher matcher
		= pattern.matcher(str);
		
		return matcher.matches();
	}
} Main public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		int top = 0;
		String s;
		int stack[] = new int[101];
		
		while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		}
		scan.close();
		System.out.println(stack[top]);
		
	} main {
		Scanner scan = new Scanner (System.in);
		int top = 0;
		String s;
		int stack[] = new int[101];
		
		while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		}
		scan.close();
		System.out.println(stack[top]);
		
	} Scanner scan = new Scanner (System.in); scan new Scanner (System.in) int top = 0; top 0 String s; s int stack[] = new int[101]; stack new int[101] 101 while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		} scan.hasNext() scan.hasNext scan {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		} s = scan.next() s scan.next() scan.next scan if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			} isNum(s) isNum s {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} stack[top + 1] = Integer.parseInt(s) stack[top + 1] stack top + 1 top 1 Integer.parseInt(s) Integer.parseInt Integer s top++ top if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			} top >= 2 top 2 {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			} switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				} s case "+": "+" case "+": stack[top - 1] = stack[top - 1] + stack[top] stack[top - 1] stack top - 1 top 1 stack[top - 1] + stack[top] stack[top - 1] stack top - 1 top 1 stack[top] stack top top-- top break; case "-": "-" case "-": stack[top - 1] = stack[top - 1] - stack[top] stack[top - 1] stack top - 1 top 1 stack[top - 1] - stack[top] stack[top - 1] stack top - 1 top 1 stack[top] stack top top-- top break; case "*": "*" case "*": stack[top - 1] = stack[top - 1] * stack[top] stack[top - 1] stack top - 1 top 1 stack[top - 1] * stack[top] stack[top - 1] stack top - 1 top 1 stack[top] stack top top-- top break; default: default: break; scan.close() scan.close scan System.out.println(stack[top]) System.out.println System.out System System.out stack[top] stack top String [] args args public static boolean isNum( String str) {
		java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$");
		java.util.regex.Matcher matcher
		= pattern.matcher(str);
		
		return matcher.matches();
	} isNum {
		java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$");
		java.util.regex.Matcher matcher
		= pattern.matcher(str);
		
		return matcher.matches();
	} java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$"); pattern java.util.regex.Pattern.compile("^[0-9]*$") java.util.regex.Pattern.compile java.util.regex.Pattern java.util.regex java.util java java.util java.util.regex java.util.regex.Pattern "^[0-9]*$" java.util.regex.Matcher matcher
		= pattern.matcher(str); matcher pattern.matcher(str) pattern.matcher pattern str return matcher.matches(); matcher.matches() matcher.matches matcher String str str public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		int top = 0;
		String s;
		int stack[] = new int[101];
		
		while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		}
		scan.close();
		System.out.println(stack[top]);
		
	}
	
	public static boolean isNum( String str) {
		java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$");
		java.util.regex.Matcher matcher
		= pattern.matcher(str);
		
		return matcher.matches();
	}
} public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		int top = 0;
		String s;
		int stack[] = new int[101];
		
		while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		}
		scan.close();
		System.out.println(stack[top]);
		
	}
	
	public static boolean isNum( String str) {
		java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$");
		java.util.regex.Matcher matcher
		= pattern.matcher(str);
		
		return matcher.matches();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		int top = 0;
		String s;
		int stack[] = new int[101];
		
		while (scan.hasNext()) {
			s = scan.next();
			
			if (isNum(s)) {
				stack[top + 1] = Integer.parseInt(s);
				top++;
			} else if (top >= 2) {
				switch (s) {
				case "+":
					stack[top - 1] = stack[top - 1] + stack[top];
					top--;
					break;
				case "-":
					stack[top - 1] = stack[top - 1] - stack[top];
					top--;
					break;
				case "*":
					stack[top - 1] = stack[top - 1] * stack[top];
					top--;
					break;
				default:
					break;
				}
			}
		}
		scan.close();
		System.out.println(stack[top]);
		
	}
	
	public static boolean isNum( String str) {
		java.util.regex.Pattern pattern 
		= java.util.regex.Pattern.compile("^[0-9]*$");
		java.util.regex.Matcher matcher
		= pattern.matcher(str);
		
		return matcher.matches();
	}
}

