1956: The great battle is imminent
题目描述
In the distant depths of the galaxy, Commander Alban of the Galactic Empire is a wise and powerful leader, commanding an invincible fleet that ensures the peace and rule of the Empire. However, recently, the Empire’s enemy, the Nether Legion, has been gathering forces, preparing to launch an unprecedented war. To enhance the fleet's fighting power, Alban decides to activate an ancient plan called the "Super Energy Core." This plan will provide the fleet with enormous energy, allowing the Empire's superweapon to have the power to destroy any enemy.
The Super Energy Core contains a special set of energy particles, each with energy values given by the sequence: 10^100, 10^100 + 1, 10^100 + 2, …, up to 10^100 + N. (1 ≤ N ≤ 2 * 10^5) These particles have a very large growth in energy values, but because the Nether Legion's attack is imminent, Alban must make a decision quickly. He needs to select k (1 ≤ K ≤ N+1) or more particles to provide enough energy for the fleet's superweapon. However, the selection of energy particles is not just a simple addition problem. The energy total for each selection of particles represents a unique power. Given the vast range and number of these energy values, Alban must compute all possible energy combinations.
To avoid excessively large numbers during the calculations, Alban decides to take all results modulo 10^9 + 7. This way, he can maintain calculation precision without handling impossibly large numbers. Additionally, to prevent the Nether Legion from overhearing the Galactic Empire's plans, all calculations must be completed in a very short time. Alban needs your help to obtain the results of all these energy combinations before the enemy attacks.
输入
输出
样例输入
3 2
样例输出
10
提示
The sum can take 10 values, as follows:
- (10**100) + (10**100 + 1) = 2×10¹⁰⁰ + 1
- (10**100) + (10**100 + 2) = 2×10¹⁰⁰ + 2
- (10**100) + (10**100 + 3) = 2×10¹⁰⁰ + 3
- (10**100 + 1) + (10**100 + 3) = 2×10¹⁰⁰ + 4
- (10**100 + 2) + (10**100 + 3) = 2×10¹⁰⁰ + 5
- (10**100) + (10**100 + 1) + (10**100 + 2) = 3×10¹⁰⁰ + 3
- (10**100) + (10**100 + 1) + (10**100 + 3 ) = 3×10¹⁰⁰ + 4
- (10**100) + (10**100 + 2) + (10**100 + 3) = 3×10¹⁰⁰ + 5
- (10**100 + 1) + (10**100 + 2) + (10**100 + 3) = 3×10¹⁰⁰ + 6
- (10**100) + (10**100 + 1) + (10**100 + 2) + (10*100 + 3 = 4 *100*100 + 6
Constraints:
$2 \le K < N \le 2 * 10^5$