Numbering Obsessively

View as PDF

Submit solution


Points: 8
Time limit: 1.0s
Memory limit: 256M

Problem types

Aslı - being an obsessive person - wants to number every line of her new notebook. But with all the obsessive numbering needs, Aslı wants every number they have written to have a sum of digits of K.

Aslı can't wrap their head around this and they need your help. Can you tell them how many numbers are there that has at most N digits and have a sum of digits of K?

Input

Two space-separated numbers N and K in one line.

Batch #1:
  • 1N5
  • 0K45
Batch #2:
  • 1N100
  • 0K900

Output

Count of numbers having N or fewer digits and sum of digits of K. Since this count can be huge, you need to take the modulo 109+7 before printing it.

Examples

Input:

Copy
2 4

Output:

Copy
5

Input:

Copy
3 3

Output:

Copy
10

Explanation

1st Input
  • 4, 13, 22, 31, 40
2nd Input
  • 3, 12, 21, 30, 102, 111, 120, 201, 210, 300