

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    int capacity = 2;
    int[] stack = new int[capacity];
    int top = 0;

    public void push(int data) {
        if(size() == capacity)
            expand();

        stack[top] = data;
        top++;
    }

    private void expand() {
        int length = size();
        int[] newStack = new int[capacity * 2];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
        capacity *= 2;
    }

    public int pop() {
        int data = 0;

        if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        }
        return data;
    }

    public void shrink() {
        int length = size();
        if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        }
        int[] newStack = new int[capacity];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
    }

    public int size() {
        return top;
    }

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

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        Main stack1 = new Main();
        int a, b;

        for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        }
        System.out.println(stack1.pop());
    }
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    int capacity = 2;
    int[] stack = new int[capacity];
    int top = 0;

    public void push(int data) {
        if(size() == capacity)
            expand();

        stack[top] = data;
        top++;
    }

    private void expand() {
        int length = size();
        int[] newStack = new int[capacity * 2];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
        capacity *= 2;
    }

    public int pop() {
        int data = 0;

        if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        }
        return data;
    }

    public void shrink() {
        int length = size();
        if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        }
        int[] newStack = new int[capacity];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
    }

    public int size() {
        return top;
    }

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

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        Main stack1 = new Main();
        int a, b;

        for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        }
        System.out.println(stack1.pop());
    }
} Main int capacity = 2; capacity 2 int[] stack = new int[capacity]; stack new int[capacity] capacity int top = 0; top 0 public void push(int data) {
        if(size() == capacity)
            expand();

        stack[top] = data;
        top++;
    } push {
        if(size() == capacity)
            expand();

        stack[top] = data;
        top++;
    } if(size() == capacity)
            expand(); size() == capacity size() size capacity expand() expand stack[top] = data stack[top] stack top data top++ top int data data private void expand() {
        int length = size();
        int[] newStack = new int[capacity * 2];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
        capacity *= 2;
    } expand {
        int length = size();
        int[] newStack = new int[capacity * 2];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
        capacity *= 2;
    } int length = size(); length size() size int[] newStack = new int[capacity * 2]; newStack new int[capacity * 2] capacity * 2 capacity 2 System.arraycopy(stack, 0 , newStack, 0, length) System.arraycopy System stack 0 newStack 0 length stack = newStack stack newStack capacity *= 2 capacity 2 public int pop() {
        int data = 0;

        if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        }
        return data;
    } pop {
        int data = 0;

        if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        }
        return data;
    } int data = 0; data 0 if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        } isEmpty() isEmpty {
            System.out.println("stack is empty");
        } System.out.println("stack is empty") System.out.println System.out System System.out "stack is empty" {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        } top-- top data = stack[top] data stack[top] stack top stack[top] = 0 stack[top] stack top 0 shrink() shrink return data; data public void shrink() {
        int length = size();
        if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        }
        int[] newStack = new int[capacity];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
    } shrink {
        int length = size();
        if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        }
        int[] newStack = new int[capacity];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
    } int length = size(); length size() size if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        } length <= (capacity/2)/2 length (capacity/2)/2 (capacity/2) capacity 2 2 {
            capacity = capacity / 2;
        } capacity = capacity / 2 capacity capacity / 2 capacity 2 int[] newStack = new int[capacity]; newStack new int[capacity] capacity System.arraycopy(stack, 0 , newStack, 0, length) System.arraycopy System stack 0 newStack 0 length stack = newStack stack newStack public int size() {
        return top;
    } size {
        return top;
    } return top; top public boolean isEmpty() {
        return top <= 0;
    } isEmpty {
        return top <= 0;
    } return top <= 0; top <= 0 top 0 public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        Main stack1 = new Main();
        int a, b;

        for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        }
        System.out.println(stack1.pop());
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        Main stack1 = new Main();
        int a, b;

        for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        }
        System.out.println(stack1.pop());
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] lines = br.readLine().split(" "); lines br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " Main stack1 = new Main(); stack1 new Main() int a a b; b for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        } String s lines {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        } {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        } if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            } s.equals("+") s.equals s "+" {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } a = stack1.pop() a stack1.pop() stack1.pop stack1 b = stack1.pop() b stack1.pop() stack1.pop stack1 stack1.push(a+b) stack1.push stack1 a+b a b if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            } s.equals("-") s.equals s "-" {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } a = stack1.pop() a stack1.pop() stack1.pop stack1 b = stack1.pop() b stack1.pop() stack1.pop stack1 stack1.push(b-a) stack1.push stack1 b-a b a if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            } s.equals("*") s.equals s "*" {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } a = stack1.pop() a stack1.pop() stack1.pop stack1 b = stack1.pop() b stack1.pop() stack1.pop stack1 stack1.push(a*b) stack1.push stack1 a*b a b {
                stack1.push(Integer.parseInt(s));
            } stack1.push(Integer.parseInt(s)) stack1.push stack1 Integer.parseInt(s) Integer.parseInt Integer s System.out.println(stack1.pop()) System.out.println System.out System System.out stack1.pop() stack1.pop stack1 String[] args args public class Main {
    int capacity = 2;
    int[] stack = new int[capacity];
    int top = 0;

    public void push(int data) {
        if(size() == capacity)
            expand();

        stack[top] = data;
        top++;
    }

    private void expand() {
        int length = size();
        int[] newStack = new int[capacity * 2];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
        capacity *= 2;
    }

    public int pop() {
        int data = 0;

        if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        }
        return data;
    }

    public void shrink() {
        int length = size();
        if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        }
        int[] newStack = new int[capacity];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
    }

    public int size() {
        return top;
    }

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

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        Main stack1 = new Main();
        int a, b;

        for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        }
        System.out.println(stack1.pop());
    }
} public class Main {
    int capacity = 2;
    int[] stack = new int[capacity];
    int top = 0;

    public void push(int data) {
        if(size() == capacity)
            expand();

        stack[top] = data;
        top++;
    }

    private void expand() {
        int length = size();
        int[] newStack = new int[capacity * 2];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
        capacity *= 2;
    }

    public int pop() {
        int data = 0;

        if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        }
        return data;
    }

    public void shrink() {
        int length = size();
        if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        }
        int[] newStack = new int[capacity];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
    }

    public int size() {
        return top;
    }

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

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        Main stack1 = new Main();
        int a, b;

        for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        }
        System.out.println(stack1.pop());
    }
} Main


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    int capacity = 2;
    int[] stack = new int[capacity];
    int top = 0;

    public void push(int data) {
        if(size() == capacity)
            expand();

        stack[top] = data;
        top++;
    }

    private void expand() {
        int length = size();
        int[] newStack = new int[capacity * 2];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
        capacity *= 2;
    }

    public int pop() {
        int data = 0;

        if(isEmpty())
        {
            System.out.println("stack is empty");
        } else {
            top--;
            data = stack[top];
            stack[top] = 0;
            shrink();
        }
        return data;
    }

    public void shrink() {
        int length = size();
        if(length <= (capacity/2)/2)
        {
            capacity = capacity / 2;
        }
        int[] newStack = new int[capacity];
        System.arraycopy(stack, 0 , newStack, 0, length);
        stack = newStack;
    }

    public int size() {
        return top;
    }

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

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        Main stack1 = new Main();
        int a, b;

        for(String s : lines)
        {
            if(s.equals("+"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a+b);
            } else if(s.equals("-"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(b-a);
            } else if(s.equals("*"))
            {
                a = stack1.pop();
                b = stack1.pop();
                stack1.push(a*b);
            } else {
                stack1.push(Integer.parseInt(s));
            }
        }
        System.out.println(stack1.pop());
    }
}

