UPDATEIT - Update the array !

题意翻译

## 题目描述 你有一个 $n$ 个元素的数组,初始全为 $0$,编号为 $0,\dots,n-1$。 你需要对其做 $u$ 次修改操作。每个修改操作你需要把区间 $[l,r]$ 内的元素加上一个值 $val$。 之后,会有 $q$ 次查询,每次查询下标为 $i$ 的数。 ## 输入输出格式 **输入格式:** 第一行,一个整数 $t(1 \le t \le 10)$,表示测试数据的组数。 每组测试数据的第一行,两个整数 $n,u(1 \le n \le 10^4,1 \le u \le 10^5)$,分别表示数组中元素的个数及修改操作的次数。 以下 $u$ 行,三个整数 $l,r,val(0 \le l,r < n,0 \le val \le 10^4)$,代表一次修改操作。 下一行,一个整数 $q(1 \le q \le 10^4)$,代表查询的次数。 以下 $q$ 行,每行一个整数 $i(0 \le i < n)$,表示一次查询。 **输出格式:** 对于每组数据,每行输出一次查询的结果。

题目描述

You have an array containing n elements initially all 0. You need to do a number of update operations on it. In each update you specify l, r and val which are the starting index, ending index and value to be added. After each update, you add the 'val' to all elements from index l to r. After 'u' updates are over, there will be q queries each containing an index for which you have to print the element at that index.

输入输出格式

输入格式


First line consists of t, the number of test cases. (1 <= t <= 10) Each test case consists of "n u",number of elements in the array and the number of update operations, in the first line (1 <= n <= 10000 and 1 <= u <= 100000) Then follow u lines each of the format "l r val" (0 <= l,r < n, 0 <= val <=10000) Next line contains q, the number of queries. (1 <= q <= 10000) Next q lines contain an index (0 <= index < n)

输出格式


For each test case, output the answers to the corresponding queries in separate lines.

输入输出样例

输入样例 #1

1
5 3
0 1 7
2 4 6
1 3 2
3
0
3
4

输出样例 #1

7
8
6