while 1:

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

    if r == 0: break

    old = [input().split() for i in range(r)]

    old = list(map(list, list(zip(*old))))

    new = [int("".join(lst),2) for lst in old]

    ans = 0

    for i in range(1<<r):

        ret = 0

        for j in new:

            cnt = bin(i^j).count('1')

            ret += cnt if cnt > r/2 else r-cnt

        ans = max(ans, ret)

    print(ans)
while 1:

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

    if r == 0: break

    old = [input().split() for i in range(r)]

    old = list(map(list, list(zip(*old))))

    new = [int("".join(lst),2) for lst in old]

    ans = 0

    for i in range(1<<(r-1)):

        ret = 0

        for j in new:

            cnt = bin(i^j).count('1')

            ret += cnt if cnt > r/2 else r-cnt

        ans = max(ans, ret)

    print(ans)
while 1:
    r, c = list(map(int, input().split()))
    if r == 0:
        break
    old = [input().split() for i in range(r)]
    old = list(map(list, list(zip(*old))))
    new = [int("".join(lst), 2) for lst in old]
    ans = 0
    for i in range(1 << r):
        ret = 0
        for j in new:
            cnt = bin(i ^ j).count("1")
            ret += cnt if cnt > r / 2 else r - cnt
        ans = max(ans, ret)
    print(ans)

while 1:
    r, c = list(map(int, input().split()))
    if r == 0:
        break
    old = [input().split() for i in range(r)]
    old = list(map(list, list(zip(*old))))
    new = [int("".join(lst), 2) for lst in old]
    ans = 0
    for i in range(1 << (r - 1)):
        ret = 0
        for j in new:
            cnt = bin(i ^ j).count("1")
            ret += cnt if cnt > r / 2 else r - cnt
        ans = max(ans, ret)
    print(ans)

-    for i in range(1 << r): +    for i in range(1 << (r - 1)):