OI XXVIII - tab

// https://szkopul.edu.pl/problemset/problem/3sQlWSD2omwi4M_wdqCbycIW/site/?key=statement

// Tablica binarna

#include <iostream>

constexpr int sizik = 1024;

bool tab[sizik][sizik];
int res = 0;

void update(int x, int y) {
    if (x < 1 || y < 1) return;

    res -= tab[x][y];
    tab[x][y] ^= 1;
    res += tab[x][y];
}

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

    int n, m, q;
    std::cin >> n >> m >> q;

    for (; q > 0; q--) {
        int a, b, c, d;
        std::cin >> a >> b >> c >> d;

        update(a - 1, b - 1);
        update(a - 1, d);
        update(c, b - 1);
        update(c, d);

        std::cout << res << '\n';
    }

    return 0;
}