#arc133d. [arc133_d]Range XOR

[arc133_d]Range XOR

Problem Statement

Given are integers LL, RR, and VV. Find the number of pairs of integers (l,r)(l,r) that satisfy both of the conditions below, modulo 998244353998244353.

  • LleqlleqrleqRL \\leq l \\leq r \\leq R
  • loplus(l+1)opluscdotsoplusr=Vl \\oplus (l+1) \\oplus \\cdots \\oplus r=V

Here, oplus\\oplus denotes the bitwise mathrmXOR\\mathrm{XOR} operation.

What is bitwise mathrmXOR\\mathrm{XOR}?

The bitwise mathrmXOR\\mathrm{XOR} of non-negative integers AA and BB, AoplusBA \\oplus B, is defined as follows:

  • When AoplusBA \\oplus B is written in base two, the digit in the 2k2^k's place (kgeq0k \\geq 0) is 11 if exactly one of AA and BB is 11, and 00 otherwise.

For example, we have 3oplus5=63 \\oplus 5 = 6 (in base two: 011oplus101=110011 \\oplus 101 = 110).
Generally, the bitwise mathrmXOR\\mathrm{XOR} of kk integers p1,p2,p3,dots,pkp_1, p_2, p_3, \\dots, p_k is defined as $(\\dots ((p_1 \\oplus p_2) \\oplus p_3) \\oplus \\dots \\oplus p_k)$. We can prove that this value does not depend on the order of p1,p2,p3,dotspkp_1, p_2, p_3, \\dots p_k.

Constraints

  • 1leqLleqRleq10181 \\leq L \\leq R \\leq 10^{18}
  • 0leqVleq10180 \\leq V \\leq 10^{18}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

LL RR VV

Output

Print the answer.


Sample Input 1

1 3 3

Sample Output 1

2

The two pairs satisfying the conditions are (l,r)=(1,2)(l,r)=(1,2) and (l,r)=(3,3)(l,r)=(3,3).


Sample Input 2

10 20 0

Sample Output 2

6

Sample Input 3

1 1 1

Sample Output 3

1

Sample Input 4

12345 56789 34567

Sample Output 4

16950