题号:NC213130
时间限制:C/C++/Rust/Pascal 3秒,其他语言6秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Bobo has two sequences

and

. He would like to perform the following operations:
+

, change the value of

to y.
+

, change the value of

to y.
+

, find the value of

, where

,
%20%5Ctext%7B%20for%20%7D%201%20%5Cle%20i%20%5Cle%20x)
.
输入描述:
The input consists of several test cases terminated by end-of-file. For each test case:
The first line contains two integers n and m , which are the length of the two sequences and the number of operations. The second line contains n integers
. The third line contains n integers
. Each of the last m lines contains a query.
* 
* 
* 
* The sum of n and the sum of m do not exceed
.
输出描述:
For each query of
, output an integer denoting the value of
.
示例1
输入
复制
4 9
1 2 3 3
-1 2 3 3
3 1
3 2
3 3
3 4
2 2 -4
3 1
3 2
3 3
3 4