import java.io.*;
class Main {
    public static  void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] formula = br.readLine().split(" ");
        Stack stack = new Stack(formula.length);
        for(String element : formula) {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        }
        System.out.println(stack.pop());
    }
}
class Stack {
        int maxLen;
        int point;
        int [] stackAry;
    public  Stack(int maxLen) {
        this.maxLen = maxLen;
        this.point = 0;
        this.stackAry = new int[maxLen];
   }
    
    public boolean isEmpty() {
        return point == 0;
   }

    public boolean isFull() {
        return point >= maxLen-1;
    }

    public void push(int x) {
        if(isFull()) {
            System.out.println(x + "はプッシュできません");
        } else {
            stackAry[++point] = x;
        }
    }
    public int pop() {
        if(isEmpty()) {
            System.out.println("要素がからです");
            return 0;
        } else {
            point--;
            return this.stackAry[point+1];
        }
    }
}
        

        

 import java.io.*; io.* java class Main {
    public static  void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] formula = br.readLine().split(" ");
        Stack stack = new Stack(formula.length);
        for(String element : formula) {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        }
        System.out.println(stack.pop());
    }
} Main public static  void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] formula = br.readLine().split(" ");
        Stack stack = new Stack(formula.length);
        for(String element : formula) {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        }
        System.out.println(stack.pop());
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] formula = br.readLine().split(" ");
        Stack stack = new Stack(formula.length);
        for(String element : formula) {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        }
        System.out.println(stack.pop());
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] formula = br.readLine().split(" "); formula br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " Stack stack = new Stack(formula.length); stack new Stack(formula.length) for(String element : formula) {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        } String element formula {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        } {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        } if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            } element.matches("[0-9]*?") element.matches element "[0-9]*?" {
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } int elem = Integer.parseInt(element); elem Integer.parseInt(element) Integer.parseInt Integer element stack.push(elem) stack.push stack elem {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            } int left = stack.pop(); left stack.pop() stack.pop stack int right = stack.pop(); right stack.pop() stack.pop stack switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                } element case "+": "+" case "+": stack.push(right + left) stack.push stack right + left right left break; case "-": "-" case "-": stack.push(right - left) stack.push stack right - left right left break; case "*": "*" case "*": stack.push(right * left) stack.push stack right * left right left break; case "/": "/" case "/": stack.push(right / left) stack.push stack right / left right left break; System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String...args args class Stack {
        int maxLen;
        int point;
        int [] stackAry;
    public  Stack(int maxLen) {
        this.maxLen = maxLen;
        this.point = 0;
        this.stackAry = new int[maxLen];
   }
    
    public boolean isEmpty() {
        return point == 0;
   }

    public boolean isFull() {
        return point >= maxLen-1;
    }

    public void push(int x) {
        if(isFull()) {
            System.out.println(x + "はプッシュできません");
        } else {
            stackAry[++point] = x;
        }
    }
    public int pop() {
        if(isEmpty()) {
            System.out.println("要素がからです");
            return 0;
        } else {
            point--;
            return this.stackAry[point+1];
        }
    }
} Stack int maxLen; maxLen int point; point int [] stackAry; stackAry public  Stack(int maxLen) {
        this.maxLen = maxLen;
        this.point = 0;
        this.stackAry = new int[maxLen];
   } Stack {
        this.maxLen = maxLen;
        this.point = 0;
        this.stackAry = new int[maxLen];
   } this.maxLen = maxLen this.maxLen this this.maxLen maxLen this.point = 0 this.point this this.point 0 this.stackAry = new int[maxLen] this.stackAry this this.stackAry new int[maxLen] maxLen int maxLen maxLen public boolean isEmpty() {
        return point == 0;
   } isEmpty {
        return point == 0;
   } return point == 0; point == 0 point 0 public boolean isFull() {
        return point >= maxLen-1;
    } isFull {
        return point >= maxLen-1;
    } return point >= maxLen-1; point >= maxLen-1 point maxLen-1 maxLen 1 public void push(int x) {
        if(isFull()) {
            System.out.println(x + "はプッシュできません");
        } else {
            stackAry[++point] = x;
        }
    } push {
        if(isFull()) {
            System.out.println(x + "はプッシュできません");
        } else {
            stackAry[++point] = x;
        }
    } if(isFull()) {
            System.out.println(x + "はプッシュできません");
        } else {
            stackAry[++point] = x;
        } isFull() isFull {
            System.out.println(x + "はプッシュできません");
        } System.out.println(x + "はプッシュできません") System.out.println System.out System System.out x + "はプッシュできません" x "はプッシュできません" {
            stackAry[++point] = x;
        } stackAry[++point] = x stackAry[++point] stackAry ++point point x int x x public int pop() {
        if(isEmpty()) {
            System.out.println("要素がからです");
            return 0;
        } else {
            point--;
            return this.stackAry[point+1];
        }
    } pop {
        if(isEmpty()) {
            System.out.println("要素がからです");
            return 0;
        } else {
            point--;
            return this.stackAry[point+1];
        }
    } if(isEmpty()) {
            System.out.println("要素がからです");
            return 0;
        } else {
            point--;
            return this.stackAry[point+1];
        } isEmpty() isEmpty {
            System.out.println("要素がからです");
            return 0;
        } System.out.println("要素がからです") System.out.println System.out System System.out "要素がからです" return 0; 0 {
            point--;
            return this.stackAry[point+1];
        } point-- point return this.stackAry[point+1]; this.stackAry[point+1] this.stackAry this this.stackAry point+1 point 1
import java.io.*;
class Main {
    public static  void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] formula = br.readLine().split(" ");
        Stack stack = new Stack(formula.length);
        for(String element : formula) {
            if(element.matches("[0-9]*?") ){
                int elem = Integer.parseInt(element);
                stack.push(elem);
            } else {
                int left = stack.pop();
                int right = stack.pop();
                switch (element) {
                    
                    case "+":
                        stack.push(right + left);
                        break;
                    case "-":
                        stack.push(right - left);
                        break;
                    case "*":
                        stack.push(right * left);
                        break;
                    case "/":
                        stack.push(right / left);
                        break;
                }
            }
        }
        System.out.println(stack.pop());
    }
}
class Stack {
        int maxLen;
        int point;
        int [] stackAry;
    public  Stack(int maxLen) {
        this.maxLen = maxLen;
        this.point = 0;
        this.stackAry = new int[maxLen];
   }
    
    public boolean isEmpty() {
        return point == 0;
   }

    public boolean isFull() {
        return point >= maxLen-1;
    }

    public void push(int x) {
        if(isFull()) {
            System.out.println(x + "はプッシュできません");
        } else {
            stackAry[++point] = x;
        }
    }
    public int pop() {
        if(isEmpty()) {
            System.out.println("要素がからです");
            return 0;
        } else {
            point--;
            return this.stackAry[point+1];
        }
    }
}
        

        


