A rectangular garden of area 48 square feet is to be surrounded on three sides by a brick wall costing 20 dollars per foot, and on the fourth side by a fence costing 10 dollars per foot. Find the smallest amount of money that can be spent on materials.