Problem: You are given a sequence of integers .
You have to construct two sequences of integers and with length that satisfy:
- for every ()
- is non-decreasing, which means that for every , must hold
- is non-increasing, which means that for every , must hold
You have to minimize . In other words, you have to minimize the maximum number in sequences and .
Also there will be changes, the -th change is described by three integers . You should add to .
You have to find the minimum possible value of for the initial sequence and for sequence after each change.
Input Format: The first line contains an integer ().
The secound line contains integers (, ).
The third line contains an integer ().
Each of the next lines contains three integers (), desribing the next change.
Output Format: Print lines.
On the -th () line, print the answer to the problem for the sequence after changes.
Note: In the first test:
- The initial sequence . Two sequences is a possible choice.
- After the first change . Two sequences is a possible choice.
- After the second change . Two sequences is a possible choice.