#arc135f. [arc135_f]Delete 1, 4, 7, ...

[arc135_f]Delete 1, 4, 7, ...

Problem Statement

You are given an integer NN. On an integer sequence A=(1,2,ldots,N)A = (1, 2, \\ldots, N), let us do the operation below exactly KK times.

  • Let nn be the current number of terms in AA. For all ii such that 1leqileqn1\\leq i \\leq n and iequiv1pmod3i\\equiv 1\\pmod{3}, delete the ii-th term of AA, simultaneously.

Find the sum of the terms of AA after KK operations, modulo 998244353998244353.

Constraints

  • 1leqNleq10141\\leq N\\leq 10^{14}
  • 1leqKleq1001\\leq K\\leq 100

Input

Input is given from Standard Input from the following format:

NN KK

Output

Print the sum of the terms of AA after KK operations, modulo 998244353998244353.


Sample Input 1

10 2

Sample Output 1

25
  • Initially, we have A=(1,2,3,4,5,6,7,8,9,10)A = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10).
  • After the first operation, we have A=(2,3,5,6,8,9)A = (2, 3, 5, 6, 8, 9).
  • After the second operation, we have A=(3,5,8,9)A = (3, 5, 8, 9).
  • The sum of the terms here is 3+5+8+9=253 + 5 + 8 + 9 = 25.

Sample Input 2

10 10

Sample Output 2

0
  • After the second operation, we have A=(3,5,8,9)A = (3, 5, 8, 9) (same as Sample Input 1).
  • After the third operation, we have A=(5,8)A = (5, 8).
  • After the fourth operation, we have A=(8)A = (8).
  • After the fifth operation, AA is empty.
  • In the sixth and subsequent operations, AA remains empty, where the sum of the terms is 00.

Sample Input 3

10000 10

Sample Output 3

862816