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

public class Main {

	
	public static void main(String argv[]) {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String num1,num2;
        int n1,n2;
        String[] tokens = str.split(" ");
        
        Stack<String> stack = new Stack<>();
        for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        }
        
        System.out.println(stack.pop());
        in.close();
    }
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	
	public static void main(String argv[]) {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String num1,num2;
        int n1,n2;
        String[] tokens = str.split(" ");
        
        Stack<String> stack = new Stack<>();
        for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        }
        
        System.out.println(stack.pop());
        in.close();
    }
} Main public static void main(String argv[]) {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String num1,num2;
        int n1,n2;
        String[] tokens = str.split(" ");
        
        Stack<String> stack = new Stack<>();
        for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        }
        
        System.out.println(stack.pop());
        in.close();
    } main {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String num1,num2;
        int n1,n2;
        String[] tokens = str.split(" ");
        
        Stack<String> stack = new Stack<>();
        for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        }
        
        System.out.println(stack.pop());
        in.close();
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String str = in.nextLine(); str in.nextLine() in.nextLine in String num1 num1 num2; num2 int n1 n1 n2; n2 String[] tokens = str.split(" "); tokens str.split(" ") str.split str " " Stack<String> stack = new Stack<>(); stack new Stack<>() for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        } int i=0; int i=0; i 0 i<tokens.length i tokens.length tokens tokens.length i++ i++ i {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        } {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        } if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	} tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*") tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*") tokens[i].equals("+") tokens[i].equals tokens[i] tokens i "+" tokens[i].equals("-") tokens[i].equals tokens[i] tokens i "-" tokens[i].equals("*") tokens[i].equals tokens[i] tokens i "*" {
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	} num2 = stack.pop() num2 stack.pop() stack.pop stack num1 = stack.pop() num1 stack.pop() stack.pop stack n1 = Integer.parseInt(num1) n1 Integer.parseInt(num1) Integer.parseInt Integer num1 n2 = Integer.parseInt(num2) n2 Integer.parseInt(num2) Integer.parseInt Integer num2 if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		} tokens[i].equals("+") tokens[i].equals tokens[i] tokens i "+" {
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		} n1 = n1 + n2 n1 n1 + n2 n1 n2 stack.push(Integer.toString(n1)) stack.push stack Integer.toString(n1) Integer.toString Integer n1 if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		} tokens[i].equals("-") tokens[i].equals tokens[i] tokens i "-" {
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		} n1 = n1 - n2 n1 n1 - n2 n1 n2 stack.push(Integer.toString(n1)) stack.push stack Integer.toString(n1) Integer.toString Integer n1 if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		} tokens[i].equals("*") tokens[i].equals tokens[i] tokens i "*" {
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		} n1 = n1 * n2 n1 n1 * n2 n1 n2 stack.push(Integer.toString(n1)) stack.push stack Integer.toString(n1) Integer.toString Integer n1 {
        		stack.push(tokens[i]);
        	} stack.push(tokens[i]) stack.push stack tokens[i] tokens i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack in.close() in.close in String argv[] argv public class Main {

	
	public static void main(String argv[]) {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String num1,num2;
        int n1,n2;
        String[] tokens = str.split(" ");
        
        Stack<String> stack = new Stack<>();
        for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        }
        
        System.out.println(stack.pop());
        in.close();
    }
} public class Main {

	
	public static void main(String argv[]) {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String num1,num2;
        int n1,n2;
        String[] tokens = str.split(" ");
        
        Stack<String> stack = new Stack<>();
        for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        }
        
        System.out.println(stack.pop());
        in.close();
    }
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

	
	public static void main(String argv[]) {

        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String num1,num2;
        int n1,n2;
        String[] tokens = str.split(" ");
        
        Stack<String> stack = new Stack<>();
        for(int i=0; i<tokens.length; i++)
        {
        	if(tokens[i].equals("+") || tokens[i].equals("-") || tokens[i].equals("*"))
        	{
        		num2 = stack.pop();
        		num1 = stack.pop();
        		n1 = Integer.parseInt(num1);
        		n2 = Integer.parseInt(num2);
        		if(tokens[i].equals("+")) 
        		{
        			n1 = n1 + n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("-"))
        		{
        			n1 = n1 - n2;
        			stack.push(Integer.toString(n1));
        		}
        		else if(tokens[i].equals("*"))
        		{
        			n1 = n1 * n2;
        			stack.push(Integer.toString(n1));
        		}
        	}
        	else
        	{
        		stack.push(tokens[i]);
        	}        		
        }
        
        System.out.println(stack.pop());
        in.close();
    }
}

