#arc133d. [arc133_d]Range XOR
[arc133_d]Range XOR
Problem Statement
Given are integers , , and . Find the number of pairs of integers that satisfy both of the conditions below, modulo .
Here, denotes the bitwise operation.
What is bitwise ?
The bitwise of non-negative integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if exactly one of and is , and otherwise.
For example, we have (in base two: ).
Generally, the bitwise of integers 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 .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
1 3 3
Sample Output 1
2
The two pairs satisfying the conditions are and .
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