Mountain
题号:NC244832
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

There are now n peaks with a valley between every two adjacent peaks.

The i th mountain has a weight a_i , and the i th valley has a weight b_i.

You now want to divide these peaks into several camps, and all the peaks of the same camp must be a continuous interval, and the dividing line between two adjacent camps must be a valley.

Now for all the peaks of each camp, you need to choose exactly one ``General Peak`` among them.

The weight of a certain distribution scheme is defined as: the weight sum of all general peaks plus the weight sum of all dividing valleys.

But your aesthetics are special, and now there are k additional bonus points:

The i th condition is given by three numbers l_i,r_i,s_i , indicating that if there are at least two dividing lines in the l_i th to r_i th valleys, the weight of this allocation scheme will be additionally increased by s_i .And these intervals do not intersect with each other.

Your aesthetic will also change, and each change will change a value in a_i,b_i,s_i.

Please find the maximum value of the distribution scheme weight after each aesthetic change.

输入描述:

In the first line, there are three integers  separated by spaces, which represent the number of peaks, the number of additional bonus conditions and the number of aesthetic changes.

The second line has n integers separated by spaces, and the i th integer is , which represents the weight of the i th peak.

The third line has n-1 integers separated by spaces, and the i th integer is , which represents the weight of the i th valley.

Then there are three integers in each of the following k lines, separated by spaces, indicating a bonus condition.And there must be .

Then there are three integers in the next m lines, separated by spaces, indicating a change in aesthetics.

When , it means changing to y, when , it means changing to y, and when , it means changing to y.

输出描述:

Output has m lines in total, and the i th line represents the maximum value of the distribution scheme weight after the i th aesthetic change.
示例1

输入

复制
2 0 1
7 -4
5
1 2 3

输出

复制
15
示例2

输入

复制
5 2 2
1 2 3 4 5
1 2 3 4
1 3 2
4 4 5
1 3 -10
2 2 -100

输出

复制
22
22