import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String[] inputs = str.split(" "); inputs str.split(" ") str.split str " " Stack<Integer> operands = new Stack<>(); operands new Stack<>() for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        } String s inputs {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        } {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        } if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            } s.equals("+") || s.equals("-") || s.equals("*") s.equals("+") || s.equals("-") || s.equals("*") s.equals("+") s.equals s "+" s.equals("-") s.equals s "-" s.equals("*") s.equals s "*" {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } int i1 = operands.pop(); i1 operands.pop() operands.pop operands int i2 = operands.pop(); i2 operands.pop() operands.pop operands switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                } s case "+": "+" case "+": operands.push(i2+i1) operands.push operands i2+i1 i2 i1 break; case "-": "-" case "-": operands.push(i2-i1) operands.push operands i2-i1 i2 i1 break; case "*": "*" case "*": operands.push(i2*i1) operands.push operands i2*i1 i2 i1 break; default: default: sc.close() sc.close sc return; {
                operands.push(Integer.parseInt(s));
            } operands.push(Integer.parseInt(s)) operands.push operands Integer.parseInt(s) Integer.parseInt Integer s System.out.println(operands.pop()) System.out.println System.out System System.out operands.pop() operands.pop operands sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    }
}

