If the points of the borderlines belong to the shaded region too then the shaded region is described by:

If this line has to pass at least through one point of the shaded region. f gets a maximum if the line is translated as much up as possible.

Thus f is maximal if x = 0 and y = 6. In this case f = 36.