A positive integer is called a cool number of power A if it can be separated into exactly A groups of consecutive digits, where the digits in each group form an arithmetic progression. An arithmetic progression is a sequence of numbers in which the difference between any two consecutive numbers is the same. For example, 123 is a cool number of power 3, 2, 1, because 123 can be divided into 3 groups 1|2|3, or 2 groups 12|3, 1|23, or 1 group 123. A positive integer is called a mega cool number of power A if it is a cool number of power A, not a cool number of power A-1, and all its digits are in non-decreasing order. For example, 123 is a mega cool number of power 1; while 321 is not a mega cool number, because its digits are in decreasing order.
Determine the number of mega cool numbers of power A that contain exactly N digits (with no leading zeroes).
Multiple test cases. Each case contains a single line with two positive integers N(1 ≤ N ≤ 1000), A(1 ≤ A ≤ 1000).
A single line per case, contains the number of mega cool numbers as described above. The result may be very large. Output it modulo 1,000,000,007.
1 1 2 1 2 2 10 3
9 45 0 7502
Case 1: There are 9 such numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9.
Case 2: Any two-digit number with non-decreasing digits will be a mega cool number of power 1.
Case 3: There are no such numbers.
Migrated from old NTUJ.
HCPC 2009 Spring
No. | Testdata Range | Score |
---|