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

public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        String[] rawInputs = sc.nextLine().split(" ");

        // Solve
        Stack<String> stack = new Stack<>();
        for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        }
        String result = stack.pop();

        // Output
        System.out.println(result);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        String[] rawInputs = sc.nextLine().split(" ");

        // Solve
        Stack<String> stack = new Stack<>();
        for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        }
        String result = stack.pop();

        // Output
        System.out.println(result);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) void solve() {
        // Input
        String[] rawInputs = sc.nextLine().split(" ");

        // Solve
        Stack<String> stack = new Stack<>();
        for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        }
        String result = stack.pop();

        // Output
        System.out.println(result);
    } solve {
        // Input
        String[] rawInputs = sc.nextLine().split(" ");

        // Solve
        Stack<String> stack = new Stack<>();
        for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        }
        String result = stack.pop();

        // Output
        System.out.println(result);
    } String[] rawInputs = sc.nextLine().split(" "); rawInputs sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " Stack<String> stack = new Stack<>(); stack new Stack<>() for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        } String input rawInputs {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        } {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        } switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            } input case "+": "+" case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                } Integer opl = Integer.valueOf(stack.pop()); opl Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack Integer opr = Integer.valueOf(stack.pop()); opr Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack Integer result = opr + opl; result opr + opl opr opl stack.push(String.valueOf(result)) stack.push stack String.valueOf(result) String.valueOf String result break; case "-": "-" case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                } Integer opl = Integer.valueOf(stack.pop()); opl Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack Integer opr = Integer.valueOf(stack.pop()); opr Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack Integer result = opr - opl; result opr - opl opr opl stack.push(String.valueOf(result)) stack.push stack String.valueOf(result) String.valueOf String result break; case "*": "*" case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                } Integer opl = Integer.valueOf(stack.pop()); opl Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack Integer opr = Integer.valueOf(stack.pop()); opr Integer.valueOf(stack.pop()) Integer.valueOf Integer stack.pop() stack.pop stack Integer result = opr * opl; result opr * opl opr opl stack.push(String.valueOf(result)) stack.push stack String.valueOf(result) String.valueOf String result break; default: default: {
                    stack.push(input);
                } stack.push(input) stack.push stack input String result = stack.pop(); result stack.pop() stack.pop stack System.out.println(result) System.out.println System.out System System.out result public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        String[] rawInputs = sc.nextLine().split(" ");

        // Solve
        Stack<String> stack = new Stack<>();
        for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        }
        String result = stack.pop();

        // Output
        System.out.println(result);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
} public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        String[] rawInputs = sc.nextLine().split(" ");

        // Solve
        Stack<String> stack = new Stack<>();
        for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        }
        String result = stack.pop();

        // Output
        System.out.println(result);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

    Scanner sc = new Scanner(System.in);

    void solve() {
        // Input
        String[] rawInputs = sc.nextLine().split(" ");

        // Solve
        Stack<String> stack = new Stack<>();
        for (String input : rawInputs) {
            switch (input) {
                case "+": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr + opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "-": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr - opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                case "*": {
                    Integer opl = Integer.valueOf(stack.pop());
                    Integer opr = Integer.valueOf(stack.pop());
                    Integer result = opr * opl;
                    stack.push(String.valueOf(result));
                    break;
                }
                default: {
                    stack.push(input);
                }
            }
        }
        String result = stack.pop();

        // Output
        System.out.println(result);
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}

