
At first glance it seems that the shortest
distance between A and B is the straight way along the sides of the
box, i.e. 1 unit up, 30 units along the top side of the box and then
11 units down the opposite side  42 units in total. But as it was
stated in the hint the shortest distance between A and B is less than
42.
To find the shortest distance out it is useful to unfold some sides of
the box into a 2D model. If to unfold them as shown in the lower right
corner of the illustration, we get a right triangle where the
hypotenuse AB is the distance between the two spots. It equals square
root of (AC^{2} + BC^{2}). AC is 32 units long (1 + 30
+ 1) and BC is 24 units long (6 + 12 + 6). Thus the distance AB equals
square root (32^{2} + 24^{2}) = square root of 1600 or
40.! 
