4499: M. XOR Sum
内存限制:256 MB
时间限制:1 S
标准输入输出
题目类型:传统
评测方式:Special Judge
上传者:
提交:0
通过:0
题目描述
Louis loves integers. He defines the value of a sequence of non-negative integers A = [a1, a2 ,…, ak] as the following formula (⊕ means bitwise exclusive-or):
He wants to know how many different sequences A holds the following conditions:
He wants to know how many different sequences A holds the following conditions:
- The length of A is k.
- The value of A is n.
- 0 ≤ ai ≤ m (1 ≤ i ≤ k).
输入格式
The input contains of single line containing three integers n, m, k, (0 <= n <= 1015, 0 <= m <= 1012, 1 <= k <= 18).
输出格式
Output the answer modulo 109 + 7.
输入样例 复制
6 2 3
输出样例 复制
12
数据范围与提示
In the first example, vaild sequences are
[0, 1, 2], [0, 2, 1], [1, 0, 2], [2, 0, 1], [1, 2, 0], [2, 1, 0], [1, 1, 2], [1, 2, 1], [2, 1, 1], [2, 2, 1], [2, 1, 2], [1, 2, 2].
input
[0, 1, 2], [0, 2, 1], [1, 0, 2], [2, 0, 1], [1, 2, 0], [2, 1, 0], [1, 1, 2], [1, 2, 1], [2, 1, 1], [2, 2, 1], [2, 1, 2], [1, 2, 2].
input
30 6 5output
1520