import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int[] stack = new int[200];
        int idx = 0;
        while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        }
        System.out.println(stack[0]);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int[] stack = new int[200];
        int idx = 0;
        while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        }
        System.out.println(stack[0]);
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    } try (Scanner in = new Scanner(System.in)) {
            solve(in);
        } {
            solve(in);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) solve(in) solve in String[] args args private static void solve(Scanner in) {
        int[] stack = new int[200];
        int idx = 0;
        while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        }
        System.out.println(stack[0]);
    } solve {
        int[] stack = new int[200];
        int idx = 0;
        while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        }
        System.out.println(stack[0]);
    } int[] stack = new int[200]; stack new int[200] 200 int idx = 0; idx 0 while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        } in.hasNext() in.hasNext in {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        } String next = in.next(); next in.next() in.next in if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            } next.equals("+") next.equals next "+" {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } stack[idx - 2] = stack[idx - 2] + stack[idx - 1] stack[idx - 2] stack idx - 2 idx 2 stack[idx - 2] + stack[idx - 1] stack[idx - 2] stack idx - 2 idx 2 stack[idx - 1] stack idx - 1 idx 1 idx-- idx if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            } next.equals("-") next.equals next "-" {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } stack[idx - 2] = stack[idx - 2] - stack[idx - 1] stack[idx - 2] stack idx - 2 idx 2 stack[idx - 2] - stack[idx - 1] stack[idx - 2] stack idx - 2 idx 2 stack[idx - 1] stack idx - 1 idx 1 idx-- idx if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            } next.equals("*") next.equals next "*" {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } stack[idx - 2] = stack[idx - 2] * stack[idx - 1] stack[idx - 2] stack idx - 2 idx 2 stack[idx - 2] * stack[idx - 1] stack[idx - 2] stack idx - 2 idx 2 stack[idx - 1] stack idx - 1 idx 1 idx-- idx {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            } int n = Integer.valueOf(next); n Integer.valueOf(next) Integer.valueOf Integer next stack[idx++] = n stack[idx++] stack idx++ idx n System.out.println(stack[0]) System.out.println System.out System System.out stack[0] stack 0 Scanner in in public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int[] stack = new int[200];
        int idx = 0;
        while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        }
        System.out.println(stack[0]);
    }
} public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int[] stack = new int[200];
        int idx = 0;
        while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        }
        System.out.println(stack[0]);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int[] stack = new int[200];
        int idx = 0;
        while (in.hasNext()) {
            String next = in.next();
            if (next.equals("+")) {
                stack[idx - 2] = stack[idx - 2] + stack[idx - 1];
                idx--;

            } else if (next.equals("-")) {
                stack[idx - 2] = stack[idx - 2] - stack[idx - 1];
                idx--;

            } else if (next.equals("*")) {
                stack[idx - 2] = stack[idx - 2] * stack[idx - 1];
                idx--;

            } else {
                int n = Integer.valueOf(next);
                stack[idx++] = n;
            }
        }
        System.out.println(stack[0]);
    }
}