while True:

  r,c = list(map(int,input().split()))

  if not r:

    break

  lst = [list(map(int,input().split())) for i in range(r)]

  dic = [0 for i in range(2 ** r)]

  for i in range(c):

    num = 0

    for j in range(r):

      num *= 2

      num += lst[j][i]

    dic[num] += 1

  ans = 0

  for i in range(2 ** r):

    ret = 0

    for j in range(2 ** r):

      num = (i ^ j)

      cnt = 0

      for k in range(r):

        cnt += num % 2

        num //= 2

      ret += max(cnt, r - cnt) * dic[j]

    ans = max(ans, ret)

  print(ans)



def f():

  while True:

    r,c = list(map(int,input().split()))

    if not r:

      break

    lst = [list(map(int,input().split())) for i in range(r)]

    dic = [0 for i in range(2 ** r)]

    for i in range(c):

      num = 0

      for j in range(r):

        num *= 2

        num += lst[j][i]

      dic[num] += 1

    ans = 0

    for i in range(2 ** r):

      ret = 0

      for j in range(2 ** r):

        num = (i ^ j)

        cnt = 0

        for k in range(r):

          cnt += num % 2

          num //= 2

        ret += max(cnt, r - cnt) * dic[j]

      ans = max(ans, ret)

    print(ans)

f()

while True:
    r, c = list(map(int, input().split()))
    if not r:
        break
    lst = [list(map(int, input().split())) for i in range(r)]
    dic = [0 for i in range(2**r)]
    for i in range(c):
        num = 0
        for j in range(r):
            num *= 2
            num += lst[j][i]
        dic[num] += 1
    ans = 0
    for i in range(2**r):
        ret = 0
        for j in range(2**r):
            num = i ^ j
            cnt = 0
            for k in range(r):
                cnt += num % 2
                num //= 2
            ret += max(cnt, r - cnt) * dic[j]
        ans = max(ans, ret)
    print(ans)

def f():
    while True:
        r, c = list(map(int, input().split()))
        if not r:
            break
        lst = [list(map(int, input().split())) for i in range(r)]
        dic = [0 for i in range(2**r)]
        for i in range(c):
            num = 0
            for j in range(r):
                num *= 2
                num += lst[j][i]
            dic[num] += 1
        ans = 0
        for i in range(2**r):
            ret = 0
            for j in range(2**r):
                num = i ^ j
                cnt = 0
                for k in range(r):
                    cnt += num % 2
                    num //= 2
                ret += max(cnt, r - cnt) * dic[j]
            ans = max(ans, ret)
        print(ans)


f()

-while True: -    r, c = list(map(int, input().split())) -    if not r: -        break -    lst = [list(map(int, input().split())) for i in range(r)] -    dic = [0 for i in range(2**r)] -    for i in range(c): -        num = 0 -        for j in range(r): -            num *= 2 -            num += lst[j][i] -        dic[num] += 1 -    ans = 0 -    for i in range(2**r): -        ret = 0 -        for j in range(2**r): -            num = i ^ j -            cnt = 0 -            for k in range(r): -                cnt += num % 2 -                num //= 2 -            ret += max(cnt, r - cnt) * dic[j] -        ans = max(ans, ret) -    print(ans) +def f(): +    while True: +        r, c = list(map(int, input().split())) +        if not r: +            break +        lst = [list(map(int, input().split())) for i in range(r)] +        dic = [0 for i in range(2**r)] +        for i in range(c): +            num = 0 +            for j in range(r): +                num *= 2 +                num += lst[j][i] +            dic[num] += 1 +        ans = 0 +        for i in range(2**r): +            ret = 0 +            for j in range(2**r): +                num = i ^ j +                cnt = 0 +                for k in range(r): +                    cnt += num % 2 +                    num //= 2 +                ret += max(cnt, r - cnt) * dic[j] +            ans = max(ans, ret) +        print(ans) + + +f()