AtCoder Regular Contest 135
F
Delete 1, 4, 7, ...
AtCoder
⌀ 3821
原题
← E→
翻译中…

Problem Statement

翻译中…

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

翻译中…
  • Let $n$ be the current number of terms in $A$. For all $i$ such that $1\leq i \leq n$ and $i\equiv 1\pmod{3}$, delete the $i$-th term of $A$, simultaneously.
翻译中…

Find the sum of the terms of $A$ after $K$ operations, modulo $998244353$.

翻译中…

Constraints

翻译中…
  • $1\leq N\leq 10^{14}$
  • $1\leq K\leq 100$
翻译中…

Input

翻译中…

Input is given from Standard Input from the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print the sum of the terms of $A$ after $K$ operations, modulo $998244353$.

翻译中…

样例

Input #1
10 2
Output #1
25
- Initially, we have $A = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)$. - After the first operation, we have $A = (2, 3, 5, 6, 8, 9)$. - After the second operation, we have $A = (3, 5, 8, 9)$. - The sum of the terms here is $3 + 5 + 8 + 9 = 25$.
Input #2
10 10
Output #2
0
- After the second operation, we have $A = (3, 5, 8, 9)$ (same as Sample Input 1). - After the third operation, we have $A = (5, 8)$. - After the fourth operation, we have $A = (8)$. - After the fifth operation, $A$ is empty. - In the sixth and subsequent operations, $A$ remains empty, where the sum of the terms is $0$.
Input #3
10000 10
Output #3
862816
题目信息
题号
arc135_f
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。