#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

#define REP(i,x)for(__typeof(x) i=0;i<x;i++)

int main(void){
  int R,C;
  while(cin>>R>>C,R){
    vector<vector<int>> a(R,vector<int>(C,0));
    REP(i,R)REP(j,C){
      cin>>a[i][j];
    }
    int ans=0;
    REP(i,1<<R){
      int a_cnt=0;
      REP(j,C){
        int c_cnt=0;
        REP(k,R)
          c_cnt += (i>>k&1)^a[k][j];
        a_cnt += max(c_cnt, R - c_cnt);
      }
      ans = max(ans, a_cnt);
    }
    cout<<ans<<endl;
  }
}