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

public class Main {
	public static void main(String [] args){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		String [ ] strings = string.split(" ");
		int size = strings.length;
		int i = 0;
		while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		}
		
		System.out.println(stack.pop());
		scanner.close();
	}
} 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> stack = new Stack<Integer>();
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		String [ ] strings = string.split(" ");
		int size = strings.length;
		int i = 0;
		while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		}
		
		System.out.println(stack.pop());
		scanner.close();
	}
} Main public static void main(String [] args){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		String [ ] strings = string.split(" ");
		int size = strings.length;
		int i = 0;
		while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		}
		
		System.out.println(stack.pop());
		scanner.close();
	} main {
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		String [ ] strings = string.split(" ");
		int size = strings.length;
		int i = 0;
		while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		}
		
		System.out.println(stack.pop());
		scanner.close();
	} Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String string = scanner.nextLine(); string scanner.nextLine() scanner.nextLine scanner String [ ] strings = string.split(" "); strings string.split(" ") string.split string " " int size = strings.length; size strings.length strings strings.length int i = 0; i 0 while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		} i<size i size {
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		} if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			} "+".equals(strings[i]) "+".equals "+" strings[i] strings i {
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			} int a = stack.pop(); a stack.pop() stack.pop stack int b = stack.pop(); b stack.pop() stack.pop stack int c = a+b; c a+b a b stack.push(c) stack.push stack c if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			} "-".equals(strings[i]) "-".equals "-" strings[i] strings i {
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			} int a = stack.pop(); a stack.pop() stack.pop stack int b = stack.pop(); b stack.pop() stack.pop stack int c = b-a; c b-a b a stack.push(c) stack.push stack c if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			} "*".equals(strings[i]) "*".equals "*" strings[i] strings i {
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			} int a = stack.pop(); a stack.pop() stack.pop stack int b = stack.pop(); b stack.pop() stack.pop stack int c = b*a; c b*a b a stack.push(c) stack.push stack c {
				stack.push(Integer.parseInt(strings[i]));
				
			} stack.push(Integer.parseInt(strings[i])) stack.push stack Integer.parseInt(strings[i]) Integer.parseInt Integer strings[i] strings i i++ i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack scanner.close() scanner.close scanner String [] args args public class Main {
	public static void main(String [] args){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		String [ ] strings = string.split(" ");
		int size = strings.length;
		int i = 0;
		while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		}
		
		System.out.println(stack.pop());
		scanner.close();
	}
} public class Main {
	public static void main(String [] args){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		String [ ] strings = string.split(" ");
		int size = strings.length;
		int i = 0;
		while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		}
		
		System.out.println(stack.pop());
		scanner.close();
	}
} Main

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

public class Main {
	public static void main(String [] args){
		Stack<Integer> stack = new Stack<Integer>();
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		String [ ] strings = string.split(" ");
		int size = strings.length;
		int i = 0;
		while( i<size ){
			if("+".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = a+b;
				stack.push(c);
			}else if("-".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b-a;
				stack.push(c);
			}else if("*".equals(strings[i])){
				int a = stack.pop();
				int b = stack.pop();
				int c = b*a;
				stack.push(c);
			}else{
				stack.push(Integer.parseInt(strings[i]));
				
			}
			i++;
		}
		
		System.out.println(stack.pop());
		scanner.close();
	}
}