from collections import defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue,datetime,random sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inpl(): return list(map(int, input().split())) def inpls(): return list(input().split()) N = int(input()) KLD = [inpl() for _ in range(N)] #N = 1 #KLD = [[7,5,2]] tmp = 0 for K,L,D in KLD: if K%2 == 1: tmp ^= ((1< A+K-1=B A = L >> D B = A + K-1 #print(A,B) bit = 0 while True : if bit == 0: if A%2 == 1 and (K+1)//2%2 == 1: tmp ^= 1<<(bit+D) #print(bit,1) elif A%2 == 0 and (K//2)%2 == 1: tmp ^= 1<<(bit+D) #print(bit,1) else: nyan = 1 #print(bit,0) else: azunyan = 0 if (A>>bit) & 1: azunyan += (1<>bit) & 1: azunyan += (B-(1< B: break bit += 1 #print(tmp) #print() print(tmp)