#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int r,c;
int s[11][10001];
bool a[11];

int cnt(){
	int ret = 0;
	for (int i = 0;i < c;i++){
		int x[2] = {0,0};
		for (int j = 0;j < r;j++){
			if(a[j]){
				x[(s[j][i]+1)%2]++;
			}else x[s[j][i]]++;
		}
		ret += max(x[0],x[1]);
	}
	return ret;
}

int dfs(int n){
	if(n == r-1){
		return cnt();
	}
	int ret = -1;
	a[n+1] = true;
	ret = dfs(n+1);
	a[n+1] = false;
	ret = max(ret,dfs(n+1));

	return ret;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	while(true){
		cin >> r >> c;
		if(r == 0) break;
		for (int i = 0;i < r;i++){
			for (int j = 0;j < c;j++){
				cin >> s[i][j];
			}
		}
		cout << dfs(-1) << endl;
	}

	return 0;

}

