You are given a one-based array consisting of integers: . Initially, the value of each element is set to .
There are operations (numbered from to ). Operation is represented by . If operation is executed, all elements for will be increased by .
You have to answer independent queries. Each query is represented by which represents the following task. Choose a range satisfying , and execute operations . The answer to the query is the maximum value of after the operations are executed among all possible choices of and .
输入格式
The first line consists of two integers ( ).
Each of the next lines consists of three integers ( ).
The following line consists of an integer ( ).
Each of the next lines consists of three integers ( ).
输出格式
For each query, output in a single line, an integer which represent the answer of the query.