#abc288h. [abc288_h]A Nameless Counting Problem
[abc288_h]A Nameless Counting Problem
Problem Statement
Print the number of integer sequences of length , , that satisfy both of the following conditions, modulo .
- $0 \\leq A_1 \\leq A_2 \\leq \\cdots \\leq A_N \\leq M$
Here, denotes bitwise XOR.
What is bitwise XOR?
The bitwise XOR of non-negative integers and , , is defined as follows.
- When is written in binary, the -th lowest bit () is if exactly one of the -th lowest bits of and is , and otherwise.
For instance, (in binary: ).
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 3 2
Sample Output 1
5
Here are the five sequences of length that satisfy both conditions in the statement: $(0, 0, 2), (0, 1, 3), (1, 1, 2), (2, 2, 2), (2, 3, 3)$.
Sample Input 2
200 900606388 317329110
Sample Output 2
788002104