P4964 Ayanokoji's Special Exam.

Background

> In this world, “victory” is everything. The process does not matter. No matter how many sacrifices it takes. As long as I “win” in the end, that is enough. ![](https://i.loli.net/2018/10/06/5bb879f4ac370.jpg)

Description

A new special exam is coming. This time the exam content is cultural courses (wan e de), but the difference is that students are allowed to use walkie-talkies during the exam. However, the receiving range of a walkie-talkie is limited (each walkie-talkie can transmit infinitely far, but can only receive signals within its receiving range), so not all students can receive broadcasts from other students. During the exam, there are $n$ students sitting in a row (numbered from left to right as $1$ to $n$). Ayanokoji sits at position $c$. Each student has an ability value $w_i$. Ayanokoji has assigned each student a walkie-talkie with receiving range $d_i$. Each student can directly solve **all** problems whose difficulty is **not greater than** their own ability value. Once a student solves a problem by their own ability, they will broadcast the solution to that problem. A student sitting at position $i$ with a walkie-talkie of receiving range $d_i$ can receive broadcasts from all students in the range $[i-d_i,\ i+d_i]$. If someone within this range has published the solution, then they will solve the problem too, and will also broadcast the solution. Ayanokoji will ask you some questions: when a problem has difficulty $x$, how many students will solve it? Since Ayanokoji wants to hide his true strength, he may modify his own ability value. These two types of operations are represented as follows: - $1\ x$: query how many students will solve a problem with difficulty $x$. - $2\ x$: modify Ayanokoji's ability value to $x$, i.e., set $w_c$ to $x$. --- Formal description (equivalent to the above): > You are given two sequences $w_{1..n}$ and $d_{1..n}$ of length $n$, and a position $c$ where $w_c$ can be modified. There are two types of operations (a total of $m$ times): - $1\ x$ indicates a query: let $f_i=\begin{cases}1\quad(w_i\ge x)\\1\quad(\exists\ j \in [i - d_i,\ i + d_i],\ f_j=1)\\ 0\quad(otherwise)\end{cases}$. Here the definition of $f_i$ refers to $f_j$, so $f_{1..n}$ will keep updating until it can no longer be updated. The answer to this query is $\sum\limits_{i=1}^nf_i$. - $2\ x$ indicates a modification: set $w_c$ to $x$.

Input Format

Because the data size is too large, to avoid slow input reading, the input is given using a **pseudorandom number generator** and is **forced online**. **It is recommended that you ignore the input format and directly use the data generator template provided below. Understanding the specific generation process is not necessary for you.** The first line contains three positive integers $n,\ m,\ c$, representing the total number of students, the total number of operations, and Ayanokoji's position. The second line contains five integers $\mathrm{seed},\ \mathrm{mind},\ \mathrm{maxd},\ \mathrm{mfq},\ k$. > Here $\mathrm{mind},\ \mathrm{maxd}$ are only used to generate the initial $d_{1..n}$. The $t$ used later to adjust $d_p$ may not be within the range $[\mathrm{mind},\ \mathrm{maxd}]$. In the next $k$ lines, each line contains two integers $p,\ t$, indicating that the receiving range of student $p$'s walkie-talkie (i.e., $d_p$) is adjusted to $t$. > If a student's walkie-talkie receiving range is adjusted multiple times, the **last** adjustment takes effect. --- **Data generator template:** ```cpp #include unsigned long long seed; int n, m, c, mfq, mind, maxd, k, w[2000001], d[2000001]; inline int randInt() { seed = 99999989 * seed + 1000000007; return seed >> 33; } void generate() { // 在读入种子后生成初始的 w 数组和 d 数组. for (int i = 1; i

Output Format

Let $ans_i$ denote the answer to the $i$-th query (operation $1$), and let $T_i=\begin{cases}(T_{i-1}\times 233+ans_i)\mod 998244353\quad(i\ge 1)\\0\quad(i=0)\end{cases}$. Let $q$ be the number of queries (operation $1$). You only need to output one integer $T_q$.

Explanation/Hint

### Variables you will need: $1\le c\le n\le 2\times 10^6$, $1\le m\le 2\times 10^6$, $0\le w_i,\ d_i,\ x