#include using namespace std; int64_t calc(int64_t K){ int64_t d = 0; for(int64_t i=K/4*4; i> N; int64_t ans = 0; while(N--){ int64_t K, L, D; cin >> K >> L >> D; int64_t B = 1LL << D; if(K%2) ans ^= L % B; int64_t offset = L / B; int64_t d = calc(K + offset) ^ calc(offset); d <<= D; ans ^= d; } cout << ans << endl; return 0; }