Redundant Binary Notation

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Binomial trees of a binomial heap. Wikimedia, cc-by-sa

Redundant binary notation is similar to binary notation, except instead of allowing only 00’s and 11’s for each digit, we allow any integer digit in the range \[0,t]\[0, t], where tt is some specified upper bound. For example, if t=2t = 2, the digit 22 is permitted, and we may write the decimal number 44 as 100100, 2020, or 1212. If t=1t=1, every number has precisely one representation, which is its typical binary representation. In general, if a number is written as d_ld_l1d_1d_0d\_l d\_{l-1} \ldots d\_1 d\_0 in redundant binary notation, the equivalent decimal number is d_l2l+d_l12l1++d_121+d_020d\_l\cdot2^l + d\_{l-1}\cdot2^{l-1} + \cdots + d\_1\cdot2^1 + d\_0\cdot2^0.

Redundant binary notation can allow carryless arithmetic, and thus has applications in hardware design and even in the design of worst-case data structures. For example, consider insertion into a standard binomial heap. This operation takes O(logn)O(\log n) worst-case time but O(1)O(1) amortized time. This is because the binary number representing the total number of elements in the heap can be incremented in O(logn)O(\log n) worst-case time and O(1)O(1) amortized time. By using a redundant binary representation of the individual binomial trees in a binomial heap, it is possible to improve the worst-case insertion time of binomial heaps to O(1)O(1).

However, none of that information is relevant to this question. In this question, your task is simple. Given a decimal number NN and the digit upper bound tt, you are to count the number of possible representations NN has in redundant binary notation with each digit in range \[0,t]\[0, t] with no leading zeros.

입력

Input consists of a single line with two decimal integers NN (0N10160 \leq N \leq 10^{16}) and tt (1t1001 \leq t \leq 100).

출력

Output in decimal the number of representations the decimal number NN has in redundant binary notation with each digit in range \[0,t]\[0, t] with no leading zeros. Since the number of representations may be very large, output the answer modulo the large prime 998,244,353998\\,244\\,353.