#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 integers, representing and respectively.
Output Format
A single line containing an integer, representing the number of valid schemes.
Samples
3 2
3
5 4
25
Sample 1 Explanation
The 3 valid sequences are as follows:
- ;
- ;
- .
Data Range
- For of the data: .
- For another of the data: .
- For another of the data: .
- For of the data: , , and is a prime number.