A landscape architect wishes to enclose a rectangular garden on one side by a brick wall costing $9 per foot and on the other three sides by a metal fence costing $3 per foot. If the area of the garden is 800 ft2, find the dimensions of the garden minimizing the cost.