#SGM0000016. Truy vấn cửa hàng pizza (Pizzeria Queries)

Truy vấn cửa hàng pizza (Pizzeria Queries)

Pizzeria Queries

Source: CSES

Version: Phuoc Hung OJ Extended

There are NN buildings on a street, numbered 11 through NN. Building ii has a pizzeria with base price pip_i. If you are in building bb and order from building aa, the total price is:

pa+∣a−b∣.p_a+|a-b|.

Process two query types:

  • 1 k x: set the pizza price at building kk to xx.
  • 2 k: while at building kk, find the minimum total price.

Input

The first line contains N,QN,Q.

The second line contains p1,…,pNp_1,\ldots,p_N.

The next QQ lines describe the queries.

Output

For every type 2 query, print the minimum price.

Subtasks

  • Subtask 1 — 20%: 1≤N,Q≤501\le N,Q\le 50, 1≤pi,x≤1041\le p_i,x\le 10^4.
  • Subtask 2 — 30%: 1≤N,Q≤50001\le N,Q\le 5000, 1≤pi,x≤1091\le p_i,x\le 10^9.
  • Subtask 3 — 50%: 1≤N,Q≤2⋅1051\le N,Q\le 2\cdot10^5, 1≤pi,x≤1091\le p_i,x\le 10^9.

Examples

Input

6 3
8 6 4 5 7 5
2 2
1 5 1
2 2

Output

5
4

Explanation

The sample follows the operations exactly; each printed line corresponds to a query that requires output.