I cant figure out this homework question! I need to use optimisation to find the answer but I cant work it out :(

There is a rectangular garden which is in need of fencing. Three sides of the 30m wide garden are already fenced. You own an additional 20m of suitable fencing and a 1m wide suitable gate. Without moving any of the existing fencing, what is the maximum area you can fence off using straight sections of fence and a corner of the existing fence to make a rectangle.

I believe you would have to input the rule: Area = L X W, somehow. But I don't know how the working would go!