Iterate over each row in the matrix. If the first element of the row is 0, toggle the entire row.
For each column from the second to the last, calculate the number of 1s in that column.
If the number of 1s is less than the number of 0s, toggle the entire column.
After all possible row and column toggles have been considered, calculate the final score by converting each row to its binary number equivalent and summing them up.