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