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

public class Main {
    static Stack<Integer> stack = new Stack<>();
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] split = sc.nextLine().trim().split(" ");
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        }
        System.out.println(stack.pop());
    }

} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
    static Stack<Integer> stack = new Stack<>();
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] split = sc.nextLine().trim().split(" ");
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        }
        System.out.println(stack.pop());
    }

} Main static Stack<Integer> stack = new Stack<>(); stack new Stack<>() public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] split = sc.nextLine().trim().split(" ");
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        }
        System.out.println(stack.pop());
    } main {

        Scanner sc = new Scanner(System.in);
        String[] split = sc.nextLine().trim().split(" ");
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        }
        System.out.println(stack.pop());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] split = sc.nextLine().trim().split(" "); split sc.nextLine().trim().split(" ") sc.nextLine().trim().split sc.nextLine().trim() sc.nextLine().trim sc.nextLine() sc.nextLine sc " " for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        } int i = 0; int i = 0; i 0 i < split.length i split.length split split.length i++ i++ i {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        } {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        } if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            } split[i].equals("+") split[i].equals split[i] split i "+" {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            } Integer pop1 = stack.pop(); pop1 stack.pop() stack.pop stack Integer pop2 = stack.pop(); pop2 stack.pop() stack.pop stack int i1 =pop1 +pop2; i1 pop1 +pop2 pop1 pop2 stack.push(i1) stack.push stack i1 if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            } split[i].equals("-") split[i].equals split[i] split i "-" {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            } Integer pop1 = stack.pop(); pop1 stack.pop() stack.pop stack Integer pop2 = stack.pop(); pop2 stack.pop() stack.pop stack int i1 =pop2 -pop1; i1 pop2 -pop1 pop2 pop1 stack.push(i1) stack.push stack i1 if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            } split[i].equals("*") split[i].equals split[i] split i "*" {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            } Integer pop1 = stack.pop(); pop1 stack.pop() stack.pop stack Integer pop2 = stack.pop(); pop2 stack.pop() stack.pop stack int i1 =pop1 *pop2; i1 pop1 *pop2 pop1 pop2 stack.push(i1) stack.push stack i1 {
                stack.push(Integer.parseInt(split[i]));
            } stack.push(Integer.parseInt(split[i])) stack.push stack Integer.parseInt(split[i]) Integer.parseInt Integer split[i] split i System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {
    static Stack<Integer> stack = new Stack<>();
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] split = sc.nextLine().trim().split(" ");
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        }
        System.out.println(stack.pop());
    }

} public class Main {
    static Stack<Integer> stack = new Stack<>();
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] split = sc.nextLine().trim().split(" ");
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        }
        System.out.println(stack.pop());
    }

} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {
    static Stack<Integer> stack = new Stack<>();
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String[] split = sc.nextLine().trim().split(" ");
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("+")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 +pop2;
                stack.push(i1);
            }
            else if (split[i].equals("-")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop2 -pop1;
                stack.push(i1);
            }
           else if (split[i].equals("*")) {
                Integer pop1 = stack.pop();
                Integer pop2 = stack.pop();
                int i1 =pop1 *pop2;
                stack.push(i1);
            }else {
                stack.push(Integer.parseInt(split[i]));
            }
        }
        System.out.println(stack.pop());
    }

}
