#include<iostream>
#include<cstdio>
using namespace std;
const int maxn=15,maxm=1e4+5;
int n,m,ans,a[maxn][maxm],b[maxn];
int cal(){
	int i,j,ans=0,sum;
	for (i=0;i<m;i++){
		sum=0;
		for (j=0;j<n;j++) sum+=a[j][i]^b[j];
		sum=max(sum,n-sum);
		ans+=sum;
	}
	return ans;
}
void dfs(int p){
	if (p==n){
		ans=max(ans,cal());
		return;
	}
	b[p]=0; dfs(p+1);
	b[p]=1; dfs(p+1);
}
int main(){
	int i,j;
	while (scanf("%d%d",&n,&m)&&n&&m){
		for (i=0;i<n;i++) for (j=0;j<m;j++) scanf("%d",&a[i][j]);
		ans=0;
		dfs(0);
		printf("%d\n",ans);
	}
	return 0;
}
