Score After Flipping Matrix

You are given an m x n binary matrix grid. You may flip any row (toggle all bits) or any column any number of times. Each row is interpreted as a binary number with the leftmost bit as most significant. Find the maximum possible sum of all row values after any sequence of flips.

Examples
Input: [[0,0,1,1],[1,0,1,0],[1,1,0,0]]
Output: 39
Hints
Related Problems

Score After Flipping Matrix

You are given an m x n binary matrix grid. You may flip any row (toggle all bits) or any column any number of times. Each row is interpreted as a binary number with the leftmost bit as most significant. Find the maximum possible sum of all row values after any sequence of flips.