Cowmistry

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Bessie has been procrastinating on her cow-mistry homework and now needs your help! She needs to create a mixture of three different cow-michals. As all good cows know though, some cow-michals cannot be mixed with each other or else they will cause an explosion. In particular, two cow-michals with labels aa and bb can only be present in the same mixture if abKa \oplus b \le K (1K1091 \le K \le 10^9).

NOTE: Here, aba\oplus b denotes the "bitwise exclusive or" of non-negative integers aa and bb. This operation is equivalent to adding each corresponding pair of bits in base 2 and discarding the carry. For example,

00=11=0,0\oplus 0=1\oplus 1=0, 10=01=1,1\oplus 0=0\oplus 1=1, 57=101_2111_2=010_2=2.5\oplus 7=101\_2\oplus 111\_2=010\_2=2.

Bessie has NN (1N21041\le N\le 2\cdot 10^4) boxes of cow-michals and the ii-th box contains cow-michals labeled l_il\_i through r_ir\_i inclusive (0l_ir_i109)(0\le l\_i \le r\_i \le 10^9). No two boxes have any cow-michals in common. She wants to know how many unique mixtures of three different cow-michals she can create. Two mixtures are considered different if there is at least one cow-michal present in one but not the other. Since the answer may be very large, report it modulo 109+710^9 + 7.

입력

The first line contains two integers NN and KK.

Each of the next NN lines contains two space-separated integers l_il\_i and r_ir\_i. It is guaranteed that the boxes of cow-michals are provided in increasing order of their contents; namely, r_i\<l_i+1r\_i\<l\_{i+1} for each 1i\<N1\le i\<N.

출력

The number of mixtures of three different cow-michals Bessie can create, modulo 109+710^9 + 7.