Solution for small input of "Box Factory"