P6308 "Wdsr-1" Foolish Structure.
Background
As everyone knows, Cirno is a fool.
Description
Cirno wants to maintain an integer sequence $a$ of length $n$, with all initial values equal to $0$.
Now Cirno wants to perform $q$ operations. Each time, she chooses a segment $[s,s+l-1]$ in the sequence and gives two numbers $w,k$, so that for all $i \in [1,l]$, $a_{s+i-1}$ is increased by $w\times i^k$.
Cirno does not want $k$ to be too large, so she gives an integer $m$ such that $0\le k\le m$.
To avoid confusing the simple-minded Cirno, you only need to output, after all operations are done in order, the result of each number in the sequence modulo $2^{64}$ (i.e. natural overflow of `unsigned long long`).
To help you better understand the statement, here is some pseudocode:
$$\def\b#1{\textbf{ #1 }}\def\t#1{\text{ #1 }}\def\s{\quad}
\def\l{\underline{\kern{300pt}}\cr[-10pt]}
\def\r{\overline{\underline{\kern{300pt}}}}
\begin{aligned}
&\r\cr&\b{Algorithm:}\t{An easy structure}\cr[-13pt]&\l\cr
&\begin{aligned}
\t{1.}&\b{input}n,m,q \cr
\t{2.}&\b{for}i=1\b{to} q \b{do} \cr
\t{3.}&\s\b{input} s,l,w,k \cr
\t{4.}&\s\b{for} j=1 \b{to} l \b{do}\cr
\t{5.}&\s\s a[s+j-1] \gets a[s+j-1]+w\times \t{pow}(j,k) \cr
\t{6.}&\s\b{end}\cr
\t{7.}&\b{end}\cr
\t{8.}&\b{for} i=1 \b{to} n \b{do}\cr
\t{9.}&\s\b{output} a[i]\cr
\t{10.}&\b{end}\cr
\end{aligned}\cr[-12pt]
&\r\end{aligned}
%Made by @离散小波变换° .
%You can find his contributions by searching "JoesSR".
$$
Here, the meaning of $\rm pow(a,b)$ is $a^b$.
Input Format
Please call `input(n,m,q,S,L,W,K)` in the code below to read $n,m,q,s_i,l_i,w_i,k_i$. Indices **start from 1**.
The meanings of $s,l,w,k$ are the same as in the description.
Output Format
Please call `output(n,R)` in the code below to output. Here, $R_i$ is the sequence after all operations, and indices **start from 1**.
Explanation/Hint
#### Explanation for Sample 1
The generated testdata is:
```plain
10 0 5
7 1 1558211206 0
1 3 401324017 0
4 5 235225636 0
6 4 2137131141 0
1 2 3791175968 0
```
Its result is:
```plain
4192499985 4192499985 401324017 235225636 235225636 2372356777 3930567983 2372356777 2137131141 0
```
---
#### Data Generation & Data Output
```cpp
typedef unsigned long long u64;
typedef unsigned int u32;
u32 MT[624],idx;
void _init(u32 seed){
MT[0]=seed; idx=0; for(int i=1;i>30)+i));
}
void _gene(){
for(int i=0;i>1);
if(x&2)MT[i]^=0x9908b0df;
}
}
u32 _calc(){
if(!idx) _gene(); int x=MT[idx];
x^=x>>11,x^=(x