So, the to enclose the two adjacent rectangles, we need to the find the perimeter of the outer rectangle
So, the perimeter =

the fencing cost is $25.8
So, the total cost = 161.7 * 25.8 = $4171.72
so, the distance around the outside = 161.7 yard
And the cost = $4171.72