#include using namespace std; #define rep(i,n) for(int i=0;i<(int)n;i++) typedef long long ll; int calc(ll s,ll m){ ll p = 1LL<<(m+1); ll k = s/p; ll cnt = k*(1LL<> n; vector cnt(62); rep(i,n){ ll k,l,d; cin >> k >> l >> d; rep(j,61){ if(j>j)&1){ cnt[j] += k%2; } }else{ ll P = (l+(k-1)*(1<>d; ll PP = (max(0LL,l-(1<>d; ll Q = j-d; int s = calc(P,Q)+calc(PP,Q); cnt[j] += s; } } } ll ans = 0; rep(i,61){ if(cnt[i]%2==1){ ans += 1LL<