시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB664100.000%

문제

It’s your Venusian friend’s birthday. You don’t remember their exact age, but you are sure it had to be no more than $10^{18}$ years. You will give them a decimal number (without leading zeros) for their birthday. You want the number of digits to be equal to their age. To make the number more interesting you will ensure that no adjacent pairs of digits will be identical.

Their exact day of birth is represented as an integer in the range $0$ to $224$ (since Venus has $225$ days in a year). To make their gift more personal you want the given number to have the same remainder as their birthday when divided by $225$.

There are potentially a lot of possible gifts that you could give. You may decide to give more than one gift. Determine the number of possible gifts modulo $10^9+7$.

입력

The single line of input contains two space separated integers $a$ ($1 \le a \le 10^{18}$) and $b$ ($0 \le b < 225$), where $a$ is the age of your friend and $b$ is the birthdate of your friend.

출력

Output a single integer, which is the number of interesting personalized numbers you could give. Since this number may be quite large, output it modulo $10^9+7$.

예제 입력 1

12345 200

예제 출력 1

323756255

예제 입력 2

100 87

예제 출력 2

896364174

예제 입력 3

100 35

예제 출력 3

785970618

예제 입력 4

5000 5

예제 출력 4

176058968

예제 입력 5

888888 88

예제 출력 5

906317283

예제 입력 6

9999999 99

예제 출력 6

133442170

예제 입력 7

101010101010 127

예제 출력 7

893501348

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2022 B번

  • 문제를 만든 사람: Travis Meade