Take the origin at a corner of the box with the axes along the edges.

Let r be the radius of a styrofoam sphere and R equal the radius of the bowling ball. The distance from the origin to the center of the bowling ball is equal to the sum of the distance from the origin to the center of the styrofoam sphere nearest the origin and the distance between the center of this sphere and the center of the bowling ball so: