import java.util.*;

class IntStack {
    int[] arr;
    int top;
    int MAX;

    public IntStack(int max) {
        this.MAX = max;
        arr = new int[max];
    }

    void initialize() {
        top = 0;
    }

    boolean isEmpty() {
        return top == 0;
    }

    boolean isFull() {
        return top >= MAX - 1;
    }

    void push(int x) {
        if (isFull()) {
            throw new RuntimeException("オーバーフロー");
        }
        top++;
        arr[this.top] = x;
    }

    int pop() {
        if (isEmpty()) {
            throw new RuntimeException("アンダーフロー");
        }
        top--;
        return arr[this.top + 1];
    }
}

public class Main {
    
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        IntStack stack = new IntStack(200);
        stack.initialize();

        while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        }

        System.out.println(stack.pop());
    }
} import java.util.*; util.* java class IntStack {
    int[] arr;
    int top;
    int MAX;

    public IntStack(int max) {
        this.MAX = max;
        arr = new int[max];
    }

    void initialize() {
        top = 0;
    }

    boolean isEmpty() {
        return top == 0;
    }

    boolean isFull() {
        return top >= MAX - 1;
    }

    void push(int x) {
        if (isFull()) {
            throw new RuntimeException("オーバーフロー");
        }
        top++;
        arr[this.top] = x;
    }

    int pop() {
        if (isEmpty()) {
            throw new RuntimeException("アンダーフロー");
        }
        top--;
        return arr[this.top + 1];
    }
} IntStack int[] arr; arr int top; top int MAX; MAX public IntStack(int max) {
        this.MAX = max;
        arr = new int[max];
    } IntStack {
        this.MAX = max;
        arr = new int[max];
    } this.MAX = max this.MAX this this.MAX max arr = new int[max] arr new int[max] max int max max void initialize() {
        top = 0;
    } initialize {
        top = 0;
    } top = 0 top 0 boolean isEmpty() {
        return top == 0;
    } isEmpty {
        return top == 0;
    } return top == 0; top == 0 top 0 boolean isFull() {
        return top >= MAX - 1;
    } isFull {
        return top >= MAX - 1;
    } return top >= MAX - 1; top >= MAX - 1 top MAX - 1 MAX 1 void push(int x) {
        if (isFull()) {
            throw new RuntimeException("オーバーフロー");
        }
        top++;
        arr[this.top] = x;
    } push {
        if (isFull()) {
            throw new RuntimeException("オーバーフロー");
        }
        top++;
        arr[this.top] = x;
    } if (isFull()) {
            throw new RuntimeException("オーバーフロー");
        } isFull() isFull {
            throw new RuntimeException("オーバーフロー");
        } throw new RuntimeException("オーバーフロー"); new RuntimeException("オーバーフロー") top++ top arr[this.top] = x arr[this.top] arr this.top this this.top x int x x int pop() {
        if (isEmpty()) {
            throw new RuntimeException("アンダーフロー");
        }
        top--;
        return arr[this.top + 1];
    } pop {
        if (isEmpty()) {
            throw new RuntimeException("アンダーフロー");
        }
        top--;
        return arr[this.top + 1];
    } if (isEmpty()) {
            throw new RuntimeException("アンダーフロー");
        } isEmpty() isEmpty {
            throw new RuntimeException("アンダーフロー");
        } throw new RuntimeException("アンダーフロー"); new RuntimeException("アンダーフロー") top-- top return arr[this.top + 1]; arr[this.top + 1] arr this.top + 1 this.top this this.top 1 public class Main {
    
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        IntStack stack = new IntStack(200);
        stack.initialize();

        while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        }

        System.out.println(stack.pop());
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        IntStack stack = new IntStack(200);
        stack.initialize();

        while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        }

        System.out.println(stack.pop());
    } main {

        Scanner sc = new Scanner(System.in);
        IntStack stack = new IntStack(200);
        stack.initialize();

        while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        }

        System.out.println(stack.pop());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) IntStack stack = new IntStack(200); stack new IntStack(200) stack.initialize() stack.initialize stack while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        } sc.hasNext() sc.hasNext sc {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        } if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            } sc.hasNextInt() sc.hasNextInt sc {
                stack.push(sc.nextInt());
            } stack.push(sc.nextInt()) stack.push stack sc.nextInt() sc.nextInt sc {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            } String s = sc.next(); s sc.next() sc.next sc int res; res if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                } s.equals("+") s.equals s "+" {
                    res = stack.pop() + stack.pop();
                } res = stack.pop() + stack.pop() res stack.pop() + stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                } s.equals("-") s.equals s "-" {
                    res = - stack.pop() + stack.pop();
                } res = - stack.pop() + stack.pop() res - stack.pop() + stack.pop() - stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                } s.equals("*") s.equals s "*" {
                    res = stack.pop() * stack.pop();
                } res = stack.pop() * stack.pop() res stack.pop() * stack.pop() stack.pop() stack.pop stack stack.pop() stack.pop stack {
                    throw new RuntimeException("hoge");
                } throw new RuntimeException("hoge"); new RuntimeException("hoge") stack.push(res) stack.push stack res 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);
        IntStack stack = new IntStack(200);
        stack.initialize();

        while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        }

        System.out.println(stack.pop());
    }
} public class Main {
    
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        IntStack stack = new IntStack(200);
        stack.initialize();

        while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        }

        System.out.println(stack.pop());
    }
} Main
import java.util.*;

class IntStack {
    int[] arr;
    int top;
    int MAX;

    public IntStack(int max) {
        this.MAX = max;
        arr = new int[max];
    }

    void initialize() {
        top = 0;
    }

    boolean isEmpty() {
        return top == 0;
    }

    boolean isFull() {
        return top >= MAX - 1;
    }

    void push(int x) {
        if (isFull()) {
            throw new RuntimeException("オーバーフロー");
        }
        top++;
        arr[this.top] = x;
    }

    int pop() {
        if (isEmpty()) {
            throw new RuntimeException("アンダーフロー");
        }
        top--;
        return arr[this.top + 1];
    }
}

public class Main {
    
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        IntStack stack = new IntStack(200);
        stack.initialize();

        while (sc.hasNext()) {
            if (sc.hasNextInt()) {
                stack.push(sc.nextInt());
            } else {
                String s = sc.next();
                int res;
                if (s.equals("+")) {
                    res = stack.pop() + stack.pop();
                } else if (s.equals("-")) {
                    res = - stack.pop() + stack.pop();
                } else if (s.equals("*")) {
                    res = stack.pop() * stack.pop();
                } else {
                    throw new RuntimeException("hoge");
                }
                stack.push(res);
            }
        }

        System.out.println(stack.pop());
    }
}
