#include"bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std; int main(){int n,m,d[11][10010],r,t,a;while(cin>>n>>m&&n&&m){rep(i,n)rep(j,m)cin>>d[i][j];r=0;rep(i,1<<n){t=0;rep(j,m){a=0;rep(k,n)a+=(d[k][j]+!!(i&(1<<k)))%2;t+=max(a,n-a);}r=max(r,t);}cout<<r<<endl;}}