import java.util.Scanner;

class Stack{
    int top,max;
    int[] arr;
    
    Stack(int num) {
        top = 0;
        max = num - 1;
        arr = new int[num]; 
    }
    public boolean isEmpty() {
        return top == 0;
    }
    public boolean isFull() {
        return top >= max;
    }
    public void push(int x) {
        if(isFull()) {
            System.out.println("This stack is ovew flow");
        } else {
            arr[++top] = x;
        }
    }
    public int pop() {
        if(isEmpty()) {
            System.out.println("This stack is empty");
        } else {
            top--;
        }
        return arr[top+1];
    }    
}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack stack = new Stack(101); 
        
        int a,b;
        String str;
        
        String[] test = new String[101]; 
        int i = 0;

        while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        }
        System.out.println(stack.pop());
    }
} import java.util.Scanner; Scanner java.util class Stack{
    int top,max;
    int[] arr;
    
    Stack(int num) {
        top = 0;
        max = num - 1;
        arr = new int[num]; 
    }
    public boolean isEmpty() {
        return top == 0;
    }
    public boolean isFull() {
        return top >= max;
    }
    public void push(int x) {
        if(isFull()) {
            System.out.println("This stack is ovew flow");
        } else {
            arr[++top] = x;
        }
    }
    public int pop() {
        if(isEmpty()) {
            System.out.println("This stack is empty");
        } else {
            top--;
        }
        return arr[top+1];
    }    
} Stack int top top max; max int[] arr; arr Stack(int num) {
        top = 0;
        max = num - 1;
        arr = new int[num]; 
    } Stack {
        top = 0;
        max = num - 1;
        arr = new int[num]; 
    } top = 0 top 0 max = num - 1 max num - 1 num 1 arr = new int[num] arr new int[num] num int num num public boolean isEmpty() {
        return top == 0;
    } isEmpty {
        return top == 0;
    } return top == 0; top == 0 top 0 public boolean isFull() {
        return top >= max;
    } isFull {
        return top >= max;
    } return top >= max; top >= max top max public void push(int x) {
        if(isFull()) {
            System.out.println("This stack is ovew flow");
        } else {
            arr[++top] = x;
        }
    } push {
        if(isFull()) {
            System.out.println("This stack is ovew flow");
        } else {
            arr[++top] = x;
        }
    } if(isFull()) {
            System.out.println("This stack is ovew flow");
        } else {
            arr[++top] = x;
        } isFull() isFull {
            System.out.println("This stack is ovew flow");
        } System.out.println("This stack is ovew flow") System.out.println System.out System System.out "This stack is ovew flow" {
            arr[++top] = x;
        } arr[++top] = x arr[++top] arr ++top top x int x x public int pop() {
        if(isEmpty()) {
            System.out.println("This stack is empty");
        } else {
            top--;
        }
        return arr[top+1];
    } pop {
        if(isEmpty()) {
            System.out.println("This stack is empty");
        } else {
            top--;
        }
        return arr[top+1];
    } if(isEmpty()) {
            System.out.println("This stack is empty");
        } else {
            top--;
        } isEmpty() isEmpty {
            System.out.println("This stack is empty");
        } System.out.println("This stack is empty") System.out.println System.out System System.out "This stack is empty" {
            top--;
        } top-- top return arr[top+1]; arr[top+1] arr top+1 top 1 public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack stack = new Stack(101); 
        
        int a,b;
        String str;
        
        String[] test = new String[101]; 
        int i = 0;

        while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        }
        System.out.println(stack.pop());
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack stack = new Stack(101); 
        
        int a,b;
        String str;
        
        String[] test = new String[101]; 
        int i = 0;

        while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        }
        System.out.println(stack.pop());
    } main {
        Scanner sc = new Scanner(System.in);
        Stack stack = new Stack(101); 
        
        int a,b;
        String str;
        
        String[] test = new String[101]; 
        int i = 0;

        while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        }
        System.out.println(stack.pop());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Stack stack = new Stack(101); stack new Stack(101) int a a b; b String str; str String[] test = new String[101]; test new String[101] 101 int i = 0; i 0 while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        } sc.hasNext() sc.hasNext sc {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        } str = sc.next() str sc.next() sc.next sc if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            } str.equals("+") str.equals str "+" {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b+a) stack.push stack b+a b a if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            } str.equals("-") str.equals str "-" {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b-a) stack.push stack b-a b a if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            } str.equals("*") str.equals str "*" {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } a = stack.pop() a stack.pop() stack.pop stack b = stack.pop() b stack.pop() stack.pop stack stack.push(b*a) stack.push stack b*a b a {
                stack.push(Integer.parseInt(str));
            } stack.push(Integer.parseInt(str)) stack.push stack Integer.parseInt(str) Integer.parseInt Integer str 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) {
        Scanner sc = new Scanner(System.in);
        Stack stack = new Stack(101); 
        
        int a,b;
        String str;
        
        String[] test = new String[101]; 
        int i = 0;

        while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        }
        System.out.println(stack.pop());
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack stack = new Stack(101); 
        
        int a,b;
        String str;
        
        String[] test = new String[101]; 
        int i = 0;

        while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        }
        System.out.println(stack.pop());
    }
} Main
import java.util.Scanner;

class Stack{
    int top,max;
    int[] arr;
    
    Stack(int num) {
        top = 0;
        max = num - 1;
        arr = new int[num]; 
    }
    public boolean isEmpty() {
        return top == 0;
    }
    public boolean isFull() {
        return top >= max;
    }
    public void push(int x) {
        if(isFull()) {
            System.out.println("This stack is ovew flow");
        } else {
            arr[++top] = x;
        }
    }
    public int pop() {
        if(isEmpty()) {
            System.out.println("This stack is empty");
        } else {
            top--;
        }
        return arr[top+1];
    }    
}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack stack = new Stack(101); 
        
        int a,b;
        String str;
        
        String[] test = new String[101]; 
        int i = 0;

        while(sc.hasNext()) {
            str = sc.next();
            
            if(str.equals("+")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b+a);
            } else if(str.equals("-")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b-a);
            } else if(str.equals("*")) {
                a = stack.pop();
                b = stack.pop();
                stack.push(b*a);
            } else {
                stack.push(Integer.parseInt(str));
            }
        }
        System.out.println(stack.pop());
    }
}