program flip_and_rectangles
  implicit none
  integer :: h, w, a(2000,2000), g(2000,2000), x, i, j
  integer :: stack(2000), left(2000), m, p, t, wid, hei
  character(2000) :: s
  a = 0
  g = 0
  stack = 0
  left = 0
  read(*,*) h, w
  do i = 1, h
    read(*,*) s
    s = trim(adjustl(s))
    do j = 1, w
      if (s(j:j).eq."#") a(i,j) = 1
    end do
  end do
  do i = 1, h-1
    do j = 1, w-1
      g(i,j) = 1-mod(sum(a(i:i+1,j:j+1)),2)
    end do
  end do
  do j = 1, w-1
    do i = 2, h-1
      if (g(i,j).eq.1) g(i,j) = g(i,j)+g(i-1,j)
    end do
  end do
  x = max(h,w)
  do i = 1, h-1
    stack(1:w) = 0
    left(1:w) = 0
    p = 1
    m = 0
    do j = 1, w-1
      t = p
      do while (p.gt.1.and.stack(p-1).ge.g(i,j))
        p = p-1
        wid = j-left(p)
        hei = stack(p)
        m = max(m,(wid+1)*(hei+1))
      end do
      if (p.eq.t) left(p) = j
      stack(p) = g(i,j)
      p = p+1
    end do
    do while (p.gt.1)
      p = p-1
      wid = w-left(p)
      hei = stack(p)
      m = max(m,(wid+1)*(hei+1))
    end do
    x = max(m,x)
  end do
  write(*,'(i0)') x
  stop
end program flip_and_rectangles