import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		LinkedList<Integer> stack = new LinkedList<Integer>();
		String[] tokens = in.nextLine().split(" ");
		int a, b, result;
		for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		}
		System.out.println(stack.pop());
		in.close();
	}
} import java.util.LinkedList; LinkedList java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		LinkedList<Integer> stack = new LinkedList<Integer>();
		String[] tokens = in.nextLine().split(" ");
		int a, b, result;
		for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		}
		System.out.println(stack.pop());
		in.close();
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		LinkedList<Integer> stack = new LinkedList<Integer>();
		String[] tokens = in.nextLine().split(" ");
		int a, b, result;
		for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		}
		System.out.println(stack.pop());
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		LinkedList<Integer> stack = new LinkedList<Integer>();
		String[] tokens = in.nextLine().split(" ");
		int a, b, result;
		for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		}
		System.out.println(stack.pop());
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) LinkedList<Integer> stack = new LinkedList<Integer>(); stack new LinkedList<Integer>() String[] tokens = in.nextLine().split(" "); tokens in.nextLine().split(" ") in.nextLine().split in.nextLine() in.nextLine in " " int a a b b result; result for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		} String t tokens {
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		} {
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		} if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			} t.matches("[0-9]+") t.matches t "[0-9]+" {
				stack.push(Integer.parseInt(t));
			} stack.push(Integer.parseInt(t)) stack.push stack Integer.parseInt(t) Integer.parseInt Integer t {
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			} a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack result = 0 result 0 switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				} t case "+" : "+" case "+" : result = b + a result b + a b a break; case "*" : "*" case "*" : result = b * a result b * a b a break; case "-" : "-" case "-" : result = b - a result b - a b a break; case "/" : "/" case "/" : result = b / a result b / a b a stack.push(result) stack.push stack result System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		LinkedList<Integer> stack = new LinkedList<Integer>();
		String[] tokens = in.nextLine().split(" ");
		int a, b, result;
		for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		}
		System.out.println(stack.pop());
		in.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		LinkedList<Integer> stack = new LinkedList<Integer>();
		String[] tokens = in.nextLine().split(" ");
		int a, b, result;
		for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		}
		System.out.println(stack.pop());
		in.close();
	}
} Main
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		LinkedList<Integer> stack = new LinkedList<Integer>();
		String[] tokens = in.nextLine().split(" ");
		int a, b, result;
		for(String t : tokens){
			if(t.matches("[0-9]+")) {
				stack.push(Integer.parseInt(t));
			}else{
				a = stack.pop();
				b = stack.pop();
				result = 0;
				switch(t){
					case "+" : result = b + a;
						       break;
					case "*" : result = b * a;
						       break;
					case "-" : result = b - a;
						       break;
					case "/" : result = b / a;
				}
				stack.push(result);
			}
		}
		System.out.println(stack.pop());
		in.close();
	}
}