This is a super common set-up for an optimization question, and our game plan will be as follows:
Write an equation for the quantity we are optimizing (in this case, the cost). Frequently, this equation will have two different independent variables (in this case x and y, the dimensions of rectangle).
Use the constraint (in this case the area to be enclosed) to write an equation relating the two independent variables. Then solver for one of them, and substitute this expression in for the variable in the other equation.
Now we will have an equation for the quantity to be optimized that only has one independent variable, so we can take the derivative, set it = 0, and solve to find the ideal values. This is what it looks like:
x: less expensive side length (in m). y: more expensive side length (in m). C: cost (in $)
C = 6x + 16y (we have 2 sides of each length to build). A = xy = 200 so y = 200/x
Substituting we get C(x) = 6x + 3,200/x
C'(x) = 6 - 3,200/x2 = 0
6x2 = 3,200
x = 40/√3 and y = 5√3
Notice their product is 200, and that we made the more expensive sides significantly shorter (which makes sense since we are trying to minimize cost).