import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
class Main{

	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int peak = 0;
		int returnNumber = 0;
		mathClass keisan =new mathClass();
		ArrayList<String> stack = new ArrayList<String>();
		stack.add("??§?¨?0 ??????????????´??????");
		while(scan.hasNext()){
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		}
		System.out.println(stack.get(peak));
	}
}
class mathClass{

	public mathClass(){

	}

	//?????????????????????
	public int shisokuEnzan(String stringX,String stringY,String op){
		int ret =0;
		int x =Integer.parseInt(stringX);
		int y =Integer.parseInt(stringY);
//		System.out.println(x+" "+op+" "+y+" wo okonau");

		if(op.charAt(0) == '+'){
			ret = x + y;
		}
		if(op.charAt(0) == '-'){
			ret = x - y;
		}
		if(op.charAt(0) == '*'){
			ret = x * y;
		}
		if(op.charAt(0) == '/'){
			ret = x / y;
		}
		return ret;
	}

	//???????????¨?????????
	public void disp(int[] ary){
		for(int i=0;i<ary.length;i++){
			System.out.println(ary[i]);
		}
	}

} import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util class Main{

	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int peak = 0;
		int returnNumber = 0;
		mathClass keisan =new mathClass();
		ArrayList<String> stack = new ArrayList<String>();
		stack.add("??§?¨?0 ??????????????´??????");
		while(scan.hasNext()){
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		}
		System.out.println(stack.get(peak));
	}
} Main public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int peak = 0;
		int returnNumber = 0;
		mathClass keisan =new mathClass();
		ArrayList<String> stack = new ArrayList<String>();
		stack.add("??§?¨?0 ??????????????´??????");
		while(scan.hasNext()){
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		}
		System.out.println(stack.get(peak));
	} main {
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int peak = 0;
		int returnNumber = 0;
		mathClass keisan =new mathClass();
		ArrayList<String> stack = new ArrayList<String>();
		stack.add("??§?¨?0 ??????????????´??????");
		while(scan.hasNext()){
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		}
		System.out.println(stack.get(peak));
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int peak = 0; peak 0 int returnNumber = 0; returnNumber 0 mathClass keisan =new mathClass(); keisan new mathClass() ArrayList<String> stack = new ArrayList<String>(); stack new ArrayList<String>() stack.add("??§?¨?0 ??????????????´??????") stack.add stack "??§?¨?0 ??????????????´??????" while(scan.hasNext()){
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		} scan.hasNext() scan.hasNext scan {
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		} stack.add(scan.next()) stack.add stack scan.next() scan.next scan peak += 1 peak 1 if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			} stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/") stack.get(peak).equals("*") stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/") stack.get(peak).equals("+") stack.get(peak).equals stack.get(peak) stack.get stack peak "+" stack.get(peak).equals("-") stack.get(peak).equals stack.get(peak) stack.get stack peak "-" stack.get(peak).equals("*") stack.get(peak).equals stack.get(peak) stack.get stack peak "*" stack.get(peak).equals("/") stack.get(peak).equals stack.get(peak) stack.get stack peak "/" {
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			} returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak)) returnNumber keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak)) keisan.shisokuEnzan keisan stack.get(peak-2) stack.get stack peak-2 peak 2 stack.get(peak-1) stack.get stack peak-1 peak 1 stack.get(peak) stack.get stack peak stack.remove(peak) stack.remove stack peak stack.remove(peak-1) stack.remove stack peak-1 peak 1 stack.remove(peak-2) stack.remove stack peak-2 peak 2 stack.add(String.valueOf(returnNumber)) stack.add stack String.valueOf(returnNumber) String.valueOf String returnNumber peak -= 2 peak 2 System.out.println(stack.get(peak)) System.out.println System.out System System.out stack.get(peak) stack.get stack peak String[] args args class mathClass{

	public mathClass(){

	}

	//?????????????????????
	public int shisokuEnzan(String stringX,String stringY,String op){
		int ret =0;
		int x =Integer.parseInt(stringX);
		int y =Integer.parseInt(stringY);
//		System.out.println(x+" "+op+" "+y+" wo okonau");

		if(op.charAt(0) == '+'){
			ret = x + y;
		}
		if(op.charAt(0) == '-'){
			ret = x - y;
		}
		if(op.charAt(0) == '*'){
			ret = x * y;
		}
		if(op.charAt(0) == '/'){
			ret = x / y;
		}
		return ret;
	}

	//???????????¨?????????
	public void disp(int[] ary){
		for(int i=0;i<ary.length;i++){
			System.out.println(ary[i]);
		}
	}

} mathClass public mathClass(){

	} mathClass {

	} //?????????????????????
	public int shisokuEnzan(String stringX,String stringY,String op){
		int ret =0;
		int x =Integer.parseInt(stringX);
		int y =Integer.parseInt(stringY);
//		System.out.println(x+" "+op+" "+y+" wo okonau");

		if(op.charAt(0) == '+'){
			ret = x + y;
		}
		if(op.charAt(0) == '-'){
			ret = x - y;
		}
		if(op.charAt(0) == '*'){
			ret = x * y;
		}
		if(op.charAt(0) == '/'){
			ret = x / y;
		}
		return ret;
	} shisokuEnzan {
		int ret =0;
		int x =Integer.parseInt(stringX);
		int y =Integer.parseInt(stringY);
//		System.out.println(x+" "+op+" "+y+" wo okonau");

		if(op.charAt(0) == '+'){
			ret = x + y;
		}
		if(op.charAt(0) == '-'){
			ret = x - y;
		}
		if(op.charAt(0) == '*'){
			ret = x * y;
		}
		if(op.charAt(0) == '/'){
			ret = x / y;
		}
		return ret;
	} int ret =0; ret 0 int x =Integer.parseInt(stringX); x Integer.parseInt(stringX) Integer.parseInt Integer stringX int y =Integer.parseInt(stringY); y Integer.parseInt(stringY) Integer.parseInt Integer stringY if(op.charAt(0) == '+'){
			ret = x + y;
		} op.charAt(0) == '+' op.charAt(0) op.charAt op 0 '+' {
			ret = x + y;
		} ret = x + y ret x + y x y if(op.charAt(0) == '-'){
			ret = x - y;
		} op.charAt(0) == '-' op.charAt(0) op.charAt op 0 '-' {
			ret = x - y;
		} ret = x - y ret x - y x y if(op.charAt(0) == '*'){
			ret = x * y;
		} op.charAt(0) == '*' op.charAt(0) op.charAt op 0 '*' {
			ret = x * y;
		} ret = x * y ret x * y x y if(op.charAt(0) == '/'){
			ret = x / y;
		} op.charAt(0) == '/' op.charAt(0) op.charAt op 0 '/' {
			ret = x / y;
		} ret = x / y ret x / y x y return ret; ret String stringX stringX String stringY stringY String op op //???????????¨?????????
	public void disp(int[] ary){
		for(int i=0;i<ary.length;i++){
			System.out.println(ary[i]);
		}
	} disp {
		for(int i=0;i<ary.length;i++){
			System.out.println(ary[i]);
		}
	} for(int i=0;i<ary.length;i++){
			System.out.println(ary[i]);
		} int i=0; int i=0; i 0 i<ary.length i ary.length ary ary.length i++ i++ i {
			System.out.println(ary[i]);
		} {
			System.out.println(ary[i]);
		} System.out.println(ary[i]) System.out.println System.out System System.out ary[i] ary i int[] ary ary
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
class Main{

	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int peak = 0;
		int returnNumber = 0;
		mathClass keisan =new mathClass();
		ArrayList<String> stack = new ArrayList<String>();
		stack.add("??§?¨?0 ??????????????´??????");
		while(scan.hasNext()){
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		}
		System.out.println(stack.get(peak));
	}
}
class mathClass{

	public mathClass(){

	}

	//?????????????????????
	public int shisokuEnzan(String stringX,String stringY,String op){
		int ret =0;
		int x =Integer.parseInt(stringX);
		int y =Integer.parseInt(stringY);
//		System.out.println(x+" "+op+" "+y+" wo okonau");

		if(op.charAt(0) == '+'){
			ret = x + y;
		}
		if(op.charAt(0) == '-'){
			ret = x - y;
		}
		if(op.charAt(0) == '*'){
			ret = x * y;
		}
		if(op.charAt(0) == '/'){
			ret = x / y;
		}
		return ret;
	}

	//???????????¨?????????
	public void disp(int[] ary){
		for(int i=0;i<ary.length;i++){
			System.out.println(ary[i]);
		}
	}

}