import java.util.*;
/**
 *  Represents a box with limited capacity
 */
public class Box {
    /** Capacity of this box -- cannot change once allocated */
    private final int capacity;

    /** How much is already filled */
    private int used;

    /** Current list of items stored */
    private ArrayList<Integer> items;

    /** Constructor makes an empty box */
    public Box(int cap) {
	capacity = cap;
	used = 0;
	items = new ArrayList<Integer>();
    }

    /** Accessor for capacity */
    public int getCapacity() {
	return capacity;
    }

    /** Accessor for Used */
    public int getUsed() {
	return used;
    }

    /** Accessor for remainder */
    public int getRemainder() {
	return capacity-used;
    }

    /** Accessor for items */
    public Integer getItem(int i) {
	return items.get(i);
    }

    /** Stores an item in the box */
    public void add(Integer item) {
	used += item;
	items.add(item);
    }

    /** Removes an item from the box by index */
    public void remove(int i) {
	used -= items.remove(i);
    }

    /** Prints capacity information */
    public void printUsage() {
	System.out.print(used+"/"+capacity);
	if (used > capacity) {
	    System.out.println(" OVER CAPACITY!");
	} else {
	    System.out.println(" OK");
	}
    }
}
