#d1401. 蜗蜗的数列
蜗蜗的数列
Wowo's Sequence
Problem Background
Original problem: CF1634F
Some meaningless strengthening has been applied.
Problem Description
Wowo has two sequences and , both of length , and will perform operations.
In each operation, he first chooses one of the sequences ( or ), then chooses an interval (), and adds the Fibonacci sequence to that interval element-wise.
In other words, he adds to the -th element, to the -th element, to the -th element, to the -th element, and so on, up to adding — the -th Fibonacci number — to the -th element.
At the end of each operation Wowo becomes very curious. He wants to know whether and are now equal. Since he gets dizzy looking at long numbers, you only need to tell whether and are equal modulo .
Input Format
The first line contains three integers , the sequence length, the total number of operations, and the modulus.
The second and third lines each contain integers, the initial values of and .
The next lines each contain a character and two integers , describing one operation. See the samples for details.
Output Format
Output lines, each containing the string Yes or No, indicating whether the two sequences are equal modulo 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 of the data, , , , and for , .