Nightmare
Limits: 2 sec., 256 MiB
To wake up calculate : \[result = \sum_{i=1}^{p} \prod_{j=0}^{m-1} \sum_{\substack{k=1, \\ k \equiv j \bmod m}}^{n} k^{i}\]
Input
The first line contains three integers \(p\), \(m\), and \(n\).
Output
Print one integer — result modulo \(10^9+7\).
Constraints
\(1 \le p \le 10\),
\(1 \le m \le 50\),
\(1 \le n \le 10^{12}\).
Samples
Input (stdin) | Output (stdout) |
---|---|
2 3 8 | 277830 |
Input (stdin) | Output (stdout) |
---|---|
3 4 1 | 0 |
Input (stdin) | Output (stdout) |
---|---|
4 5 6 | 321427757 |
Source: Open LNU Programming Contest 2021
Submit a solution
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|