#d1401. 蜗蜗的数列

蜗蜗的数列

Wowo's Sequence

Problem Background

Original problem: CF1634F

Some meaningless strengthening has been applied.

Problem Description

Wowo has two sequences AA and BB, both of length nn, and will perform qq operations.

In each operation, he first chooses one of the sequences (AA or BB), then chooses an interval [l,r][l, r] (1≤l≤r≤n1 \le l \le r \le n), and adds the Fibonacci sequence to that interval element-wise.

In other words, he adds 11 to the ll-th element, 11 to the (l+1)(l+1)-th element, 22 to the (l+2)(l+2)-th element, 33 to the (l+3)(l+3)-th element, and so on, up to adding Fib⁡(r−l+1)\operatorname{Fib}(r-l+1) — the (r−l+1)(r-l+1)-th Fibonacci number — to the rr-th element.

At the end of each operation Wowo becomes very curious. He wants to know whether AA and BB are now equal. Since he gets dizzy looking at long numbers, you only need to tell whether AA and BB are equal modulo MM.

Input Format

The first line contains three integers n,q,Mn, q, M, the sequence length, the total number of operations, and the modulus.

The second and third lines each contain nn integers, the initial values of AA and BB.

The next qq lines each contain a character cc and two integers l,rl, r, describing one operation. See the samples for details.

Output Format

Output qq lines, each containing the string Yes or No, indicating whether the two sequences are equal modulo MM at that moment.

Sample Input 1

3 5 3
2 2 1
0 0 0
A 1 3
A 1 3
B 1 1
B 2 2
A 3 3

Sample Output 1

Yes
No
No
No
Yes

Sample Input 2

5 3 10
2 5 0 3 5
3 5 8 2 5
B 2 3
B 3 4
A 1 2

Sample Output 2

No
No
Yes

Constraints

For 100%100\% of the data, 1≤n≤1061 \le n \le 10^6, 1≤q≤1061 \le q \le 10^6, 1≤M≤109+71 \le M \le 10^9+7, and for 1≤i≤n1 \le i \le n, 0≤∣Ai∣,∣Bi∣≤1090 \le |A_i|, |B_i| \le 10^9.