A livestock pen is built in the shape of a rectangle that is twice as long as it is wide. The perimeter is 48 feet. If the material used to build the pen is $1.85 per foot for the longer sides and $2.35 per foot for the shorter sides (the shorter sides have gates, which increase the cost per foot), find the cost to build the pen.