import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Deque<Integer> stack = new ArrayDeque<Integer>();

        while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        }
        System.out.println(stack.pop());
        
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Deque<Integer> stack = new ArrayDeque<Integer>();

        while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        }
        System.out.println(stack.pop());
        
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Deque<Integer> stack = new ArrayDeque<Integer>();

        while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        }
        System.out.println(stack.pop());
        
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Deque<Integer> stack = new ArrayDeque<Integer>();

        while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        }
        System.out.println(stack.pop());
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Deque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        } sc.hasNext() sc.hasNext sc {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        } String n = sc.next(); n sc.next() sc.next sc if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            } n.equals("+") n.equals n "+" {
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } int a = stack.pop()+stack.pop(); a stack.pop()+stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack stack.push(a) stack.push stack a if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            } n.equals("-") n.equals n "-" {
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } int x = stack.pop(); x stack.pop() stack.pop stack int y = stack.pop(); y stack.pop() stack.pop stack int a = y-x; a y-x y x stack.push(a) stack.push stack a if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            } n.equals("*") n.equals n "*" {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } int a = stack.pop()*stack.pop(); a stack.pop()*stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack stack.push(a) stack.push stack a {
                stack.push(Integer.parseInt(n));
            } stack.push(Integer.parseInt(n)) stack.push stack Integer.parseInt(n) Integer.parseInt Integer n System.out.println(stack.pop()) System.out.println System.out System System.out stack.pop() stack.pop stack String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Deque<Integer> stack = new ArrayDeque<Integer>();

        while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        }
        System.out.println(stack.pop());
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Deque<Integer> stack = new ArrayDeque<Integer>();

        while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        }
        System.out.println(stack.pop());
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        Deque<Integer> stack = new ArrayDeque<Integer>();

        while(sc.hasNext()) {
            String n = sc.next();
            if (n.equals("+")){
                int a = stack.pop()+stack.pop();
                stack.push(a);
            } else if (n.equals("-")){
                int x = stack.pop();
                int y = stack.pop();
                int a = y-x;
                stack.push(a);
            } else if (n.equals("*")) {
                int a = stack.pop()*stack.pop();
                stack.push(a);
            } else {
                stack.push(Integer.parseInt(n));
            }
            
        }
        System.out.println(stack.pop());
        
    }
}

