Can you answer these queries - 3#2907

Can you answer these queries - 3

1 second
64 megabytes
Very easy (≈850)

You are given an integer sequence a_1, a_2, \ldots, a_n (|a_i| \leq 10000, 1 \leq n \leq 50000). On this sequence, you have to perform (m \leq 50000) operations:

Input

The first line contains the integer . The second line contains integers, representing the sequence a_1, a_2, \ldots, a_n. The third line contains the integer . The next lines contain the queries in the following form:

  • : change a_x to (|y| \leq 10000).

  • : print \mathrm{MAX}\ \{ a_i + a_{i+1} + \ldots + a_j \mid x \leq i \leq j \leq y \}.

Output

For each query, output the required answer.

Examples

Example 1

Loading
Loading