import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> stack = new Stack<Integer>();
		String[] str = br.readLine().split(" ");
		int a = 0 ;
		for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		}
		System.out.println(stack.pop());
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Stack; Stack java.util public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> stack = new Stack<Integer>();
		String[] str = br.readLine().split(" ");
		int a = 0 ;
		for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		}
		System.out.println(stack.pop());
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> stack = new Stack<Integer>();
		String[] str = br.readLine().split(" ");
		int a = 0 ;
		for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		}
		System.out.println(stack.pop());
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> stack = new Stack<Integer>();
		String[] str = br.readLine().split(" ");
		int a = 0 ;
		for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		}
		System.out.println(stack.pop());
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) Stack<Integer> stack = new Stack<Integer>(); stack new Stack<Integer>() String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int a = 0 ; a 0 for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		} int i = 0 ; int i = 0 ; i 0 i < str.length i str.length str str.length i ++ i ++ i {
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		} {
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		} if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			} str[i].equals("+") str[i].equals str[i] str i "+" {
				stack.push(stack.pop()+stack.pop());
			} stack.push(stack.pop()+stack.pop()) stack.push stack stack.pop()+stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			} str[i].equals("-") str[i].equals str[i] str i "-" {
				stack.push(-1*stack.pop()+stack.pop());
			} stack.push(-1*stack.pop()+stack.pop()) stack.push stack -1*stack.pop()+stack.pop() -1*stack.pop() -1 1 stack.pop() stack.pop stack stack.pop() stack.pop stack if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			} str[i].equals("*") str[i].equals str[i] str i "*" {
				stack.push(stack.pop()*stack.pop());
			} stack.push(stack.pop()*stack.pop()) stack.push stack stack.pop()*stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			} str[i].equals("/") str[i].equals str[i] str i "/" {
				a = stack.pop();
				stack.push(stack.pop()/a);
			} a = stack.pop() a stack.pop() stack.pop stack stack.push(stack.pop()/a) stack.push stack stack.pop()/a stack.pop() stack.pop stack a {
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			} stack.push(Integer.parseInt(str[i])) stack.push stack Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i 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) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> stack = new Stack<Integer>();
		String[] str = br.readLine().split(" ");
		int a = 0 ;
		for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		}
		System.out.println(stack.pop());
	}
} public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> stack = new Stack<Integer>();
		String[] str = br.readLine().split(" ");
		int a = 0 ;
		for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		}
		System.out.println(stack.pop());
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Stack<Integer> stack = new Stack<Integer>();
		String[] str = br.readLine().split(" ");
		int a = 0 ;
		for(int i = 0 ; i < str.length ; i ++){
			if(str[i].equals("+")){
				stack.push(stack.pop()+stack.pop());
			}
			else if(str[i].equals("-")){
				stack.push(-1*stack.pop()+stack.pop());
			}
			else if(str[i].equals("*")){
				stack.push(stack.pop()*stack.pop());
			}
			else if(str[i].equals("/")){
				a = stack.pop();
				stack.push(stack.pop()/a);
			}
			else{
				//System.out.println(str[i]+": push now");
				stack.push(Integer.parseInt(str[i]));
			}
		}
		System.out.println(stack.pop());
	}
}