I have a calculus math problem I need help with

The area of the field is:
A = (x + 20)y
The length of fence needed is:
x + y + x + 20
(remember that 20 ft are not needed because the building, and y ft are not needed because the river)
We have 1000 ft of fencing, then:
1000 = x + y + x + 20
1000 - 20 = 2x + y
980 = 2x + y
Isolating y from the preceding equation:
y = 980 - 2x
Substituting this into the area equation:
A = (x + 20)(980 - 2x)
Distributing:
[tex]\begin{gathered} A=980x-2x^2+20\cdot980-40x \\ A=-2x^2+940x+19600 \end{gathered}[/tex]At the maximum, the derivative of A with respect to x is zero, then:
[tex]\begin{gathered} \frac{dA}{dx}=\frac{d}{dx}(-2x^2+940x+19600) \\ \frac{dA}{dx}=-2\frac{d}{dx}(x^2)+940\cdot\frac{dx}{dx}+\frac{d}{dx}(19600) \\ \frac{dA}{dx}=-4x+940 \\ 0=-4x+940 \\ 4x=940 \\ x=\frac{940}{4} \\ x=235 \end{gathered}[/tex]Recalling the equation of y and substituting this result:
y = 980 - 2x
y = 980 - 2*235
y = 510
The dimensions are:
length: 255 ft (on the side without the building)
width: 510 ft