SKRICE - Rice Cracker

no tags 

Since its foundation, IOI Confectionery has been making rice crackers in a traditional style, where one
side of crackers is char-grilled for a certain period of time, then they are turned, and the other side is
char-grilled for a certain period of time. Though they keep the tradition. they now use an automated
grilling machine to make crackers. Inside this machine, crackers are arranged in a grid with R rows and
C columns (1 ≤ R ≤ 10, 1 ≤ C ≤ 10000). The machine is usually operated automatically, and all the
crackers are turned at the same time when one side is grilled for the right amount of time.
One day they were right in the middle of the grilling process and about to turn the crackers when
an earthquake occurred and some of the crackers were turned inadvertently. Fortunately, the charcoals
were in a good state. They switched the machine to the manual operation at once to turn only the
crackers that were not already turned; otherwise one side of the crackers will be grilled for too long and
they cannot be shipped as products. This machine is capable of turning one or more rows at the same
time or one or more columns at the same time, but not capable of turning just one cracker.
If they spend too much time to turn the crackers, the crackers will be burned too much and not
suitable for shipping. They decided to first turn some rows and then turn some columns so that they
would maximize the number of ready-to-ship crackers, or the crackers both of whose sides would be
suitably grilled without overgrilling one side. They can choose not to turn any rows, and they can also
choose not to turn any columns. Write a program which computes the maximum number of ready-to-
ship crackers.

Input

Line 1 of the input file contains two space-separated integers R and C (1 ≤ R ≤ 10, 1 ≤ C ≤ 10000).
The following R lines specify the state of crackers just after the earthquake. Line i + 1 (1 ≤ i ≤ R)
contains C space-separated integers ai,1 , ai,2 , . . . , ai,C , where ai, j specifies the state of the cracker at
row i, column j. It is not yet turned if ai, j is 1, and it is already turned if ai, j is 0.

Output

Each output file to submit consists of one line, and the line contains the maximum number of ready-to-
ship crackers.

Example

Input:
2 5
0 1 0 1 0
1 0 0 0 1 Output:
9


Added by:Nhung anh sao dem
Date:2013-10-14
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:JOI 7th