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());
	}
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz