Recall that the binomial coefficient $$$\binom{x}{y}$$$ is calculated as follows ($$$x$$$ and $$$y$$$ are non-negative integers):
You are given an array $$$a_1, a_2, \dots, a_n$$$ and an integer $$$k$$$. You have to calculate a new array $$$b_1, b_2, \dots, b_n$$$, where
Formally, $$$b_i = (\sum\limits_{j=1}^{i} \binom{i - j + 1}{k} \cdot a_j) \bmod 998244353$$$.
Note that the array is given in a modified way, and you have to output it in a modified way as well.
The only line of the input contains six integers $$$n$$$, $$$a_1$$$, $$$x$$$, $$$y$$$, $$$m$$$ and $$$k$$$ ($$$1 \le n \le 10^7$$$; $$$0 \le a_1, x, y < m$$$; $$$2 \le m \le 998244353$$$; $$$1 \le k \le 5$$$).
The array $$$[a_1, a_2, \dots, a_n]$$$ is generated as follows:
Since outputting up to $$$10^7$$$ integers might be too slow, you have to do the following:
Let $$$c_i = b_i \cdot i$$$ (without taking modulo $$$998244353$$$ after the multiplication). Print the integer $$$c_1 \oplus c_2 \oplus \dots \oplus c_n$$$, where $$$\oplus$$$ denotes the bitwise XOR operator.
5 8 2 3 100 2
1283
Name |
---|