You are given an array of elements a_0, a_1, \ldots, a_{255}, which is initially filled with zeros. You are required to support two types of operations on this array: range addition and range sum query.
The range addition operation is described as \textbf{Add}(L, R, value), which means you need to add to each element a_L, a_{L+1}, \ldots, a_R of the array. The range sum operation is described as \textbf{Get}(L, R) and should return \sum_{i=L}^{R} a_i.
For efficiency of input and output, the first operation is always \textbf{Add}(L, R, 1) using given values and . Each subsequent operation is of the form
where L_{\text{new}} and R_{\text{new}} are computed as follows:
where indicates taking the remainder after division by .
After each such operation, update L := L_{\text{new}} and R := R_{\text{new}}.
The only line of the input contains four integers , , , (1 \leq q \leq 5 \cdot 10^6,\ 0 \leq L \leq R \leq 255,\ 1 \leq p \leq 125), where is the number of operations, and are initial values, and is the modulus.
Print the value of \textbf{Get}(0, 255) after all operations have been performed.
Example 1