A rectangular prism has a total surface area of 48. Also, the sum of all the edges of the prism is 40. Find the length of the diagonal joining one corner of the prism to the opposite corner.

The length of the diagonals works out to 6*sqrt(7).