#P6358. Sum of Fibonacci Products
Sum of Fibonacci Products
Sum of Fibonacci Products
Given three integers l, r, and k, compute the following sum modulo 998244353
:
\[ \sum_{i=l}^{r} \prod_{j=i}^{i+k-1} f_j \]
Here, the Fibonacci sequence \(\{f_n\}\) is defined as follows:
- \(f_0 = 0\)
- \(f_1 = 1\)
- \(f_n = f_{n-1} + f_{n-2}\) for \(n \ge 2\)
Your task is to output the sum modulo 998244353
.
inputFormat
The input consists of a single line containing three space-separated integers l
, r
, and k
.
outputFormat
Output a single integer — the value of the sum defined above modulo 998244353
.
sample
0 5 1
12