Time limit
2s
Memory limit
128 MB
An N×M rectangle is filled with N×M digits.
Divide the rectangle into three non-overlapping smaller rectangles. Every cell must belong to exactly one smaller rectangle, and each smaller rectangle must contain at least one cell.
The sum of a smaller rectangle is the sum of the digits inside it. Find the maximum possible product of the three sums after dividing the given rectangle into three smaller rectangles.
The first line contains the rectangle height N and width M.
The next N lines describe the rectangle from top to bottom. Each line contains exactly M digits.
N and M are positive integers at most 50. The rectangle contains at least three cells. Each cell contains one decimal digit.
Print the maximum possible product of the sums of the three smaller rectangles.