class Solution:
def maxArea(self, h: int, w: int, hh: List[int], ww: List[int]) -> int:
"""tc O(NlgN) sc O(1)
1. sort height and width
2. find max height and and max width, note the edge width and edge height
3. get the max area = max_height * max_width
"""
M = 10**9+7
hh.sort()
ww.sort()
max_h, max_w = max(hh[0],h-hh[-1]), max(ww[0],w-ww[-1])
for i in range(1,len(hh)):
height = hh[i]- hh[i-1]
max_h = max(max_h,height)
for j in range(1,len(ww)):
width = ww[j]- ww[j-1]
max_w = max(max_w,width)
return max_w * max_h %M