#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <string>
#include <cmath>
#include <limits>

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);

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

    int res = 0;

    /*for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            res ^= k[i][j];
        }
    }*/

    std::cout << res << std::endl;
}