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

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        System.out.println(calcurate(values));
    }

    private static long calcurate(String[] values) {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        return stack.pop().longValue();
    }
}
 import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        System.out.println(calcurate(values));
    }

    private static long calcurate(String[] values) {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        return stack.pop().longValue();
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        System.out.println(calcurate(values));
    } main {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        System.out.println(calcurate(values));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] values = scanner.nextLine().split(" "); values scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " System.out.println(calcurate(values)) System.out.println System.out System System.out calcurate(values) calcurate values String[] args args private static long calcurate(String[] values) {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        return stack.pop().longValue();
    } calcurate {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        return stack.pop().longValue();
    } Stack<Long> stack = new Stack<>(); stack new Stack<>() for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        } int i = 0; int i = 0; i 0 i < values.length i values.length values values.length i++ i++ i {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        } {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        } switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            } values[i] values i case "+": "+" case "+": stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        )) stack.push stack Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ) Long.valueOf Long stack.pop().longValue() + stack.pop().longValue() stack.pop().longValue() stack.pop().longValue stack.pop() stack.pop stack stack.pop().longValue() stack.pop().longValue stack.pop() stack.pop stack break; case "-": "-" case "-": long b = stack.pop().longValue(); b stack.pop().longValue() stack.pop().longValue stack.pop() stack.pop stack long a = stack.pop().longValue(); a stack.pop().longValue() stack.pop().longValue stack.pop() stack.pop stack stack.push(Long.valueOf(a - b)) stack.push stack Long.valueOf(a - b) Long.valueOf Long a - b a b break; case "*": "*" case "*": stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        )) stack.push stack Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ) Long.valueOf Long stack.pop().longValue() * stack.pop().longValue() stack.pop().longValue() stack.pop().longValue stack.pop() stack.pop stack stack.pop().longValue() stack.pop().longValue stack.pop() stack.pop stack break; default: default: stack.push(Long.parseLong(values[i])) stack.push stack Long.parseLong(values[i]) Long.parseLong Long values[i] values i return stack.pop().longValue(); stack.pop().longValue() stack.pop().longValue stack.pop() stack.pop stack String[] values values public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        System.out.println(calcurate(values));
    }

    private static long calcurate(String[] values) {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        return stack.pop().longValue();
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        System.out.println(calcurate(values));
    }

    private static long calcurate(String[] values) {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        return stack.pop().longValue();
    }
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] values = scanner.nextLine().split(" ");
        System.out.println(calcurate(values));
    }

    private static long calcurate(String[] values) {
        Stack<Long> stack = new Stack<>();

        for (int i = 0; i < values.length; i++) {

            switch (values[i]) {
            case "+":
                stack.push(Long.valueOf(
                        stack.pop().longValue() + stack.pop().longValue()
                        ));
                break;
            case "-":
                long b = stack.pop().longValue();
                long a = stack.pop().longValue();
                stack.push(Long.valueOf(a - b));
                break;
            case "*":
                stack.push(Long.valueOf(
                        stack.pop().longValue() * stack.pop().longValue()
                        ));
                break;
            default:
                stack.push(Long.parseLong(values[i]));
            }
        }

        return stack.pop().longValue();
    }
}

