import java.util.*;
public class Main
{	
	public static void main(String[] args)
	{
		Stack<String> stack = new Stack<String>();
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> operators = new ArrayList<String>();
		operators.add("*"); 
		operators.add("/"); 
		operators.add("-"); 
		operators.add("+");
		//////////////////////////////////////// apparently there's a Scanner bug and having 2 scanners fixes it
		Scanner in = new Scanner(System.in);
		String bug = in.nextLine();
		Scanner real = new Scanner(bug);
		////////////////////////////////////////
		while(real.hasNext())
		{
			list.add(real.next());
		}
		in.close();
		real.close();
		////////////////////////////////////////
		for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		}
		System.out.println(stack.pop());
	}
} import java.util.*; util.* java public class Main
{	
	public static void main(String[] args)
	{
		Stack<String> stack = new Stack<String>();
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> operators = new ArrayList<String>();
		operators.add("*"); 
		operators.add("/"); 
		operators.add("-"); 
		operators.add("+");
		//////////////////////////////////////// apparently there's a Scanner bug and having 2 scanners fixes it
		Scanner in = new Scanner(System.in);
		String bug = in.nextLine();
		Scanner real = new Scanner(bug);
		////////////////////////////////////////
		while(real.hasNext())
		{
			list.add(real.next());
		}
		in.close();
		real.close();
		////////////////////////////////////////
		for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		}
		System.out.println(stack.pop());
	}
} Main public static void main(String[] args)
	{
		Stack<String> stack = new Stack<String>();
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> operators = new ArrayList<String>();
		operators.add("*"); 
		operators.add("/"); 
		operators.add("-"); 
		operators.add("+");
		//////////////////////////////////////// apparently there's a Scanner bug and having 2 scanners fixes it
		Scanner in = new Scanner(System.in);
		String bug = in.nextLine();
		Scanner real = new Scanner(bug);
		////////////////////////////////////////
		while(real.hasNext())
		{
			list.add(real.next());
		}
		in.close();
		real.close();
		////////////////////////////////////////
		for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		}
		System.out.println(stack.pop());
	} main {
		Stack<String> stack = new Stack<String>();
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> operators = new ArrayList<String>();
		operators.add("*"); 
		operators.add("/"); 
		operators.add("-"); 
		operators.add("+");
		//////////////////////////////////////// apparently there's a Scanner bug and having 2 scanners fixes it
		Scanner in = new Scanner(System.in);
		String bug = in.nextLine();
		Scanner real = new Scanner(bug);
		////////////////////////////////////////
		while(real.hasNext())
		{
			list.add(real.next());
		}
		in.close();
		real.close();
		////////////////////////////////////////
		for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		}
		System.out.println(stack.pop());
	} Stack<String> stack = new Stack<String>(); stack new Stack<String>() ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() ArrayList<String> operators = new ArrayList<String>(); operators new ArrayList<String>() operators.add("*") operators.add operators "*" operators.add("/") operators.add operators "/" operators.add("-") operators.add operators "-" operators.add("+") operators.add operators "+" Scanner in = new Scanner(System.in); in new Scanner(System.in) String bug = in.nextLine(); bug in.nextLine() in.nextLine in Scanner real = new Scanner(bug); real new Scanner(bug) while(real.hasNext())
		{
			list.add(real.next());
		} real.hasNext() real.hasNext real {
			list.add(real.next());
		} list.add(real.next()) list.add list real.next() real.next real in.close() in.close in real.close() real.close real for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		} int i =0; int i =0; i 0 i<list.size() i list.size() list.size list i++ i++ i {
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		} {
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		} if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			} !operators.contains(list.get(i)) operators.contains(list.get(i)) operators.contains operators list.get(i) list.get list i {
				stack.push(list.get(i));
			} stack.push(list.get(i)) stack.push stack list.get(i) list.get list i {
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			} int n2 = Integer.valueOf(stack.pop()); n2 Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack int n1 = Integer.valueOf(stack.pop()); n1 Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				} list.get(i).equals(operators.get(0)) list.get(i).equals list.get(i) list.get list i operators.get(0) operators.get operators 0 {
					stack.push(String.valueOf(n1*n2));
				} stack.push(String.valueOf(n1*n2)) stack.push stack String.valueOf(n1*n2) String.valueOf String n1*n2 n1 n2 if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				} list.get(i).equals(operators.get(1)) list.get(i).equals list.get(i) list.get list i operators.get(1) operators.get operators 1 {
					stack.push(String.valueOf(n1/n2));
				} stack.push(String.valueOf(n1/n2)) stack.push stack String.valueOf(n1/n2) String.valueOf String n1/n2 n1 n2 if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				} list.get(i).equals(operators.get(2)) list.get(i).equals list.get(i) list.get list i operators.get(2) operators.get operators 2 {
					stack.push(String.valueOf(n1-n2));
				} stack.push(String.valueOf(n1-n2)) stack.push stack String.valueOf(n1-n2) String.valueOf String n1-n2 n1 n2 {
					stack.push(String.valueOf(n1+n2));
				} stack.push(String.valueOf(n1+n2)) stack.push stack String.valueOf(n1+n2) String.valueOf String n1+n2 n1 n2 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)
	{
		Stack<String> stack = new Stack<String>();
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> operators = new ArrayList<String>();
		operators.add("*"); 
		operators.add("/"); 
		operators.add("-"); 
		operators.add("+");
		//////////////////////////////////////// apparently there's a Scanner bug and having 2 scanners fixes it
		Scanner in = new Scanner(System.in);
		String bug = in.nextLine();
		Scanner real = new Scanner(bug);
		////////////////////////////////////////
		while(real.hasNext())
		{
			list.add(real.next());
		}
		in.close();
		real.close();
		////////////////////////////////////////
		for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		}
		System.out.println(stack.pop());
	}
} public class Main
{	
	public static void main(String[] args)
	{
		Stack<String> stack = new Stack<String>();
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> operators = new ArrayList<String>();
		operators.add("*"); 
		operators.add("/"); 
		operators.add("-"); 
		operators.add("+");
		//////////////////////////////////////// apparently there's a Scanner bug and having 2 scanners fixes it
		Scanner in = new Scanner(System.in);
		String bug = in.nextLine();
		Scanner real = new Scanner(bug);
		////////////////////////////////////////
		while(real.hasNext())
		{
			list.add(real.next());
		}
		in.close();
		real.close();
		////////////////////////////////////////
		for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		}
		System.out.println(stack.pop());
	}
} Main
import java.util.*;
public class Main
{	
	public static void main(String[] args)
	{
		Stack<String> stack = new Stack<String>();
		ArrayList<String> list = new ArrayList<String>();
		ArrayList<String> operators = new ArrayList<String>();
		operators.add("*"); 
		operators.add("/"); 
		operators.add("-"); 
		operators.add("+");
		//////////////////////////////////////// apparently there's a Scanner bug and having 2 scanners fixes it
		Scanner in = new Scanner(System.in);
		String bug = in.nextLine();
		Scanner real = new Scanner(bug);
		////////////////////////////////////////
		while(real.hasNext())
		{
			list.add(real.next());
		}
		in.close();
		real.close();
		////////////////////////////////////////
		for(int i =0;i<list.size();i++)
		{
			if(!operators.contains(list.get(i)))
			{
				stack.push(list.get(i));
			}
			else
			{
				//sets the values for the numbers that are to be computed
				int n2 = Integer.valueOf(stack.pop());
				int n1 = Integer.valueOf(stack.pop());
				//checks what the next operator is
				if(list.get(i).equals(operators.get(0)))
				{
					stack.push(String.valueOf(n1*n2));
				}
				else if(list.get(i).equals(operators.get(1)))
				{
					stack.push(String.valueOf(n1/n2));
				}
				else if(list.get(i).equals(operators.get(2)))
				{
					stack.push(String.valueOf(n1-n2));
				}
				else
				{
					stack.push(String.valueOf(n1+n2));
				}
			}
		}
		System.out.println(stack.pop());
	}
}
