Preparando MOJI
In this task, Nastya asked us to write a formal statement.
An array $$$a$$$ of length $$$n$$$ and an array $$$k$$$ of length $$$n-1$$$ are given. Two types of queries should be processed:
It's guaranteed that initially $$$a_i + k_i \leq a_{i+1}$$$ for all $$$1 \leq i \leq n-1$$$.
The first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^{5}$$$) — the number of elements in the array $$$a$$$.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$-10^{9} \leq a_i \leq 10^{9}$$$) — the elements of the array $$$a$$$.
The third line contains $$$n-1$$$ integers $$$k_1, k_2, \ldots, k_{n-1}$$$ ($$$-10^{6} \leq k_i \leq 10^{6}$$$) — the elements of the array $$$k$$$.
The fourth line contains a single integer $$$q$$$ ($$$1 \leq q \leq 10^{5}$$$) — the number of queries.
Each of the following $$$q$$$ lines contains a query of one of two types:
For each query of the second type print a single integer in a new line — the sum of the corresponding subarray.
3 1 2 3 1 -1 5 s 2 3 + 1 2 s 1 2 + 3 1 s 2 3
5 7 8
3 3 6 7 3 1 3 + 1 3 + 2 4 s 1 3
33
In the first example:
In the second example: