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

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Stack<String> stack = new Stack<>();
		
		String input = in.nextLine();
		String[] tokens = input.split(" ");
		
		for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		}
		
		System.out.println(stack.pop());
	}
} import java.util.Stack; Stack java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Stack<String> stack = new Stack<>();
		
		String input = in.nextLine();
		String[] tokens = input.split(" ");
		
		for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		}
		
		System.out.println(stack.pop());
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Stack<String> stack = new Stack<>();
		
		String input = in.nextLine();
		String[] tokens = input.split(" ");
		
		for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		}
		
		System.out.println(stack.pop());
	} main {
		Scanner in = new Scanner(System.in);
		Stack<String> stack = new Stack<>();
		
		String input = in.nextLine();
		String[] tokens = input.split(" ");
		
		for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		}
		
		System.out.println(stack.pop());
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) Stack<String> stack = new Stack<>(); stack new Stack<>() String input = in.nextLine(); input in.nextLine() in.nextLine in String[] tokens = input.split(" "); tokens input.split(" ") input.split input " " for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		} String n tokens {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		} {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		} int o1 o1 o2; o2 String[] operations = {"+", "-", "*", "/"}; operations {"+", "-", "*", "/"} "+" "-" "*" "/" boolean op = false; op false for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			} String operation operations {
				if (n.equals(operation)) {
					op = true;
				}
			} {
				if (n.equals(operation)) {
					op = true;
				}
			} if (n.equals(operation)) {
					op = true;
				} n.equals(operation) n.equals n operation {
					op = true;
				} op = true op true if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			} op {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} o1 = Integer.parseInt(stack.pop()) o1 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack o2 = Integer.parseInt(stack.pop()) o2 Integer.parseInt(stack.pop()) Integer.parseInt Integer stack.pop() stack.pop stack switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				} n case "+": "+" case "+": stack.push("" + (o2 + o1)) stack.push stack "" + (o2 + o1) "" (o2 + o1) o2 o1 break; case "-": "-" case "-": stack.push("" + (o2 - o1)) stack.push stack "" + (o2 - o1) "" (o2 - o1) o2 o1 break; case "*": "*" case "*": stack.push("" + (o2 * o1)) stack.push stack "" + (o2 * o1) "" (o2 * o1) o2 o1 break; case "/": "/" case "/": stack.push("" + (o2 / o1)) stack.push stack "" + (o2 / o1) "" (o2 / o1) o2 o1 break; case "%": "%" case "%": stack.push("" + (o2 % o1)) stack.push stack "" + (o2 % o1) "" (o2 % o1) o2 o1 break; {
				stack.push(n);
			} stack.push(n) stack.push stack n 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) {
		Scanner in = new Scanner(System.in);
		Stack<String> stack = new Stack<>();
		
		String input = in.nextLine();
		String[] tokens = input.split(" ");
		
		for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		}
		
		System.out.println(stack.pop());
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Stack<String> stack = new Stack<>();
		
		String input = in.nextLine();
		String[] tokens = input.split(" ");
		
		for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		}
		
		System.out.println(stack.pop());
	}
} Main
import java.util.Stack;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Stack<String> stack = new Stack<>();
		
		String input = in.nextLine();
		String[] tokens = input.split(" ");
		
		for (String n : tokens) {
			int o1, o2;
			
			String[] operations = {"+", "-", "*", "/"};
			boolean op = false;
			
			for (String operation : operations) {
				if (n.equals(operation)) {
					op = true;
				}
			}
			
			if (op) {
				o1 = Integer.parseInt(stack.pop());
				o2 = Integer.parseInt(stack.pop());
				
				switch (n) {
					case "+":
						stack.push("" + (o2 + o1));
						break;
					case "-":
						stack.push("" + (o2 - o1));
						break;
					case "*":
						stack.push("" + (o2 * o1));
						break;
					case "/":
						stack.push("" + (o2 / o1));
						break;
					case "%":
						stack.push("" + (o2 % o1));
						break;
				}
			} else {
				stack.push(n);
			}
		}
		
		System.out.println(stack.pop());
	}
}
