A rectangular garden of area 480 square feet is to be surrounded on three sides bya brick wall costing $12 per foot and on one side by a fence costing $5 per foot. Find the dimensions of the garden such that the cost of the materials is minimized.