#P62. [KBC005F] Count 3
[KBC005F] Count 3
Source
This problem is adapted from Long Long OJ. All rights reserved.
Problem Description
Given integers and , find the number of ways to construct a non-negative integer sequence of length (indexed from ) such that for any integer between and , .
The answer should be taken modulo .
Input Format
A single line containing two non-negative integers .
Output Format
A single line containing a non-negative integer representing the answer.
Samples
3 2
3
5 4
25
Sample 1 Explanation
The 3 valid sequences are as follows:
- ;
- ;
- .
Data Range
- For of the test cases: .
- For another of the test cases: .
- For another of the test cases: .
- For of the test cases: , , and is a prime number.