Alice has recently received an array a_1, a_2, ..., a_n for her birthday! She is very proud of her array, and when she showed her friend Bob the array, he was very happy with her present too!

However, soon Bob became curious, and as any sane friend would do, asked Alice to perform q operations of two types on her array:

  * 1 x y: update the element a_x to y (set a_x = y). 
  * 2 l r: calculate how many non-decreasing subarrays exist within the subarray [a_l, a_{l+1}, ..., a_r]. More formally, count the number of pairs of integers (p,q) such that l ≤ p ≤ q ≤ r and a_p ≤ a_{p+1} ≤ ... ≤ a_{q-1} ≤ a_q. 



Help Alice answer Bob's queries!

Input

The first line contains two integers n and q (1 ≤ n, q ≤ 2 ⋅ 10^5) — the size of the array, and the number of queries, respectively.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the elements of Alice's array.

The next q lines consist of three integers each. The first integer of the i-th line is t_i, the operation being performed on the i-th step (t_i = 1 or t_i = 2).

If t_i = 1, the next two integers are x_i and y_i (1 ≤ x_i ≤ n; 1 ≤ y_i ≤ 10^9), updating the element at position x_i to y_i (setting a_{x_i} = y_i).

If t_i = 2, the next two integers are l_i and r_i (1 ≤ l_i ≤ r_i ≤ n), the two indices Bob asks Alice about for the i-th query.

It's guaranteed that there is at least one operation of the second type.

Output

For each query of type 2, print a single integer, the answer to the query.

Example

Input


5 6
3 1 4 1 5
2 2 5
2 1 3
1 4 4
2 2 5
1 2 6
2 2 5


Output


6
4
10
7

Note

For the first query, l = 2 and r = 5, and the non-decreasing subarrays [p,q] are [2,2], [3,3], [4,4], [5,5], [2,3] and [4,5].
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define izq nod * 2
#define der nod * 2 + 1
#define mid (( a + b ) >> 1)
#define oo (1<<30)
#define oo64 (1LL<<62LL)
#define fr first
#define sc second
#define pb push_back
#define m_p make_pair
#define len(X) ((int)((X).size()))
#define all(X) (X).begin(), (X).end()
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define NO1 cout<<'-'<<'1'<<'\n'

using namespace std;

typedef long long int64;
typedef unsigned long long unt64;
typedef pair<int, int> pii;
typedef pair<int64, int64> pll;


const int MX = 400005;
const int64 MOD = 1000000007; 

int64 A[MX],B[MX];

struct node{
	int64 ci = 0;
    int64 cf = 0;
    int64 fn = 0;
    int64 val = 0;
    int64 tot = 0;
    
    int64 sum ( int64 f ){
	      return f * (f+1ll)/2ll;
	}
    
    node operator & (const node &p){
        node ans;
        
        ans.val = val + p.val;
        
        if ( A[fn] <= A[fn+1] ){
	        ans.val += cf * p.ci;
	    }
	    
	    ans.ci = ci;
	    if ( ci == tot && A[fn] <= A[fn+1] ){
	        ans.ci += p.ci;
	    } 
        ans.cf = p.cf;
        if ( p.cf == p.tot && A[fn] <= A[fn+1] ){
	        ans.cf += cf;
	    } 
	    ans.tot = tot + p.tot;
	    ans.fn = p.fn;
	    return ans;
    }
    
}NEUTRO;

struct st_vectores{
    vector<node> T;
    vector<int64> mk;
    vector<pii>P;
    int tot;
    int64 neutro_lazy = oo64;
    
    st_vectores(): T(2,NEUTRO), mk(2, neutro_lazy), P(2,{0,0}), tot(1){}
    
    void verificar ( int nod ){
	     if ( P[nod].fr == 0 ){
			 P.pb({0,0}); P.pb({0,0}); T.pb( NEUTRO ); T.pb( NEUTRO );
			 mk.pb ( neutro_lazy ); mk.pb ( neutro_lazy );
			 tot += 2;P[nod].fr=tot-1,P[nod].sc=tot;
		 }
    }
    
    void lazy(int64 a, int64 b, int nod){
         
         A[a] = {mk[nod]};
         
         if ( a != b ){  verificar ( nod );
			     if ( mk[P[nod].fr] != neutro_lazy )mk[P[nod].fr] = mk[nod];
	             else mk[P[nod].fr] = neutro_lazy;
	             if ( mk[P[nod].sc] != neutro_lazy )mk[P[nod].sc] = mk[nod];
	             else mk[P[nod].sc] = neutro_lazy;}
	     mk[nod] = neutro_lazy;}
	     
    node build( int64 a, int64 b, int nod ){
        
        if ( a == b ){
	        return T[nod] = { 1, 1, a, 1, 1 };
	    }
         
        verificar ( nod );
        return T[nod] = build(a, mid, P[nod].fr) & 
                        build(mid+1, b, P[nod].sc);}
    
    node update( int64 a, int64 b, int nod, int64 in, int64 fn, int64 val ){
        if( mk[nod] != neutro_lazy )
            lazy(a, b, nod);
            
        if( a > fn || b < in )
            return T[nod];
            
        if( a >= in && b <= fn ){
               mk[nod] = val;  lazy ( a,b,nod );
            return T[nod];    }
            
        verificar ( nod );
        return T[nod] = update(a, mid, P[nod].fr, in, fn, val) & 
                        update(mid+1, b, P[nod].sc, in, fn, val);}
    
    node query(int64 a, int64 b, int nod, int64 in, int64 fn){
        if( mk[nod] != neutro_lazy )
            lazy(a, b, nod);
            
        if( a > fn || b < in ){
            return NEUTRO;}
            
        if( a >= in && b <= fn ){
            return T[nod]; }    
        verificar ( nod );
        return query(a, mid, P[nod].fr, in, fn ) & 
               query(mid+1, b, P[nod].sc, in, fn);    }
};

void solve(){
     
     int n,q;
     cin>>n>>q;
     
     for ( int i = 1; i <= n; i++ ){
	      cin>>A[i];
	 }
	
	 st_vectores ds;
	 
	 ds.build ( 1,n,1 );
	 
	 for ( int i = 1; i <= q; i++ ){
	     int x;
	     cin>>x;
	     
	     if ( x == 2 ){ 
	     int l,r;
	     cin>>l>>r;
	     
	     cout<<ds.query ( 1,n,1,l,r ).val<<'\n';   
	     }
	     else {
		    int id,va;
		    cin>>id>>va;
		    
		    ds.update ( 1,n,1,id,id,va );
		 }
	 }
     
}

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
    //int t; cin>>t;
    //while( t-- ) 
          solve(); 	
	
return 0;	
}
