#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    int ans = 0;
    for (int k = 30; k >= 0; k--) {
        vector<int> rows(n), cols(m);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if ((a[i][j] >> k) & 1) {
                    rows[i]++;
                    cols[j]++;
                }
            }
        }

        int row_count = count_if(rows.begin(), rows.end(), [](int x){ return x % 2 == 1; });
        int col_count = count_if(cols.begin(), cols.end(), [](int x){ return x % 2 == 1; });

        if (row_count % 2 == 1 && col_count % 2 == 1) {
            ans += (1 << k);
        }
    }

    cout << ans << endl;

    return 0;
}