A garden is in the shape of a square with a perimeter of 48 feet. The garden is surrounded by two fences. One fence is around the perimeter of the garden, whereas the second fence is 3 feet from the first fence on the outside. If the material used to build the two fences is $ 1.21 per foot, what was the total cost of the fences?