#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; scanf("%lld %lld %lld",&k,&l,&d); rep(j,61){ if(j>j)&1){ cnt[j] += k%2; } }else{ ll P = (l+(k-1)*(1<>d; ll PP = (l)>>d; if(PP>0)PP--; ll Q = j-d; int s = calc(P,Q)+calc(PP,Q); cnt[j] += s; } //cerr << j << " " << cnt[j] << endl; } } ll ans = 0; rep(i,61){ if(cnt[i]%2==1){ ans += 1LL<