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].
import java.io.*;
import java.util.*;

public class Main{
	static class segmentTree {
		int[]arr,leftmost,rightmost,pref,suff;
		long[]sTree;
		int N;
		public segmentTree(int[]in) {//in array is 1-based array
			arr=in;
			int n=in.length;
			N=1;
			while(N<n) {
				N<<=1;
			}
			leftmost=new int[N<<1];
			rightmost=new int[N<<1];
			pref=new int[N<<1];
			suff=new int[N<<1];
			sTree=new long[N<<1];
			build(1,1,N);
		}
		void build(int node,int left,int right) {
			if(left==right) {
				if(left>=arr.length) {
					sTree[node]=0;//the value that won't affect the required operation
				}
				else {
					leftmost[node]=rightmost[node]=arr[left];
					sTree[node]=pref[node]=suff[node]=1;
				}
				return;
			}
			int mid=(left+right)>>1;
			int leftChild=node<<1,rightChild=node<<1|1;
			build(leftChild, left, mid);
			build(rightChild, mid+1, right);
			sTree[node]=sTree[leftChild]+sTree[rightChild];
			leftmost[node]=leftmost[leftChild];
			rightmost[node]=rightmost[rightChild];
			if(leftmost[rightChild]>=rightmost[leftChild]) {
				sTree[node]+=pref[rightChild]*1l*suff[leftChild];
				pref[node]=pref[leftChild];
				if(pref[node]==(mid-left+1)) {
					pref[node]+=pref[rightChild];
				}
				suff[node]=suff[rightChild];
				if(suff[node]==(right-mid)) {
					suff[node]+=suff[leftChild];
				}
			}
			else {
				pref[node]=pref[leftChild];
				suff[node]=suff[rightChild];
			}
		}
		long query(int left,int right) {
			return query(1, 1, N, left, right)[0];
		}
		long[] query(int node,int curLeft,int curRight,int left,int right) {
			if(curLeft>right || curRight<left)return new long[] {0,0,0,0,0};//the value that won't affect the required operation
			
			if(curLeft>=left && curRight<=right) {
				return new long[] {sTree[node],leftmost[node],rightmost[node],pref[node],suff[node]};
			}
			int mid=(curLeft+curRight)>>1;
			int leftChild=node<<1,rightChild=node<<1|1;
			long[]q1=query(leftChild, curLeft, mid, left, right);
			long[]q2=query(rightChild, mid+1, curRight, left, right);
			
			long[]ans=new long[5];
			ans[0]=q1[0]+q2[0];
			ans[1]=q1[1];
			ans[2]=q2[2];
			if(q2[1]>=q1[2]) {
				ans[0]+=q2[3]*q1[4];
				ans[3]=q1[3];
				if(ans[3]==(mid-curLeft+1)) {
					ans[3]+=q2[3];
				}
				ans[4]=q2[4];
				if(ans[4]==(curRight-mid)) {
					ans[4]+=q1[4];
				}
			}
			else {
				ans[3]=q1[3];
				ans[4]=q2[4];
			}
			return ans;
		}
		void update_Point(int i, int val){
			update_Point(1,1,N,i,val);
		}
		
		void update_Point(int node,int curLeft,int curRight,int idx,int val) {
			if(curLeft==curRight) {
				leftmost[node]=rightmost[node]=val;
				sTree[node]=pref[node]=suff[node]=1;
				return;
			}
			int mid=(curLeft+curRight)>>1;
			int leftChild=node<<1,rightChild=node<<1|1;
			if(idx<=mid)
				update_Point(leftChild, curLeft, mid, idx, val);
			else
				update_Point(rightChild, mid+1, curRight, idx ,val);
			
			sTree[node]=sTree[leftChild]+sTree[rightChild];
			leftmost[node]=leftmost[leftChild];
			rightmost[node]=rightmost[rightChild];
			if(leftmost[rightChild]>=rightmost[leftChild]) {
				sTree[node]+=pref[rightChild]*1l*suff[leftChild];
				pref[node]=pref[leftChild];
				if(pref[node]==(mid-curLeft+1)) {
					pref[node]+=pref[rightChild];
				}
				suff[node]=suff[rightChild];
				if(suff[node]==(curRight-mid)) {
					suff[node]+=suff[leftChild];
				}
			}
			else {
				pref[node]=pref[leftChild];
				suff[node]=suff[rightChild];
			}
		}
		
	}
	static void main() throws Exception{
		int n=sc.nextInt(),q=sc.nextInt();
		int[]in=new int[n+1];
		for(int i=1;i<=n;i++)in[i]=sc.nextInt();
		segmentTree st=new segmentTree(in);
		while(q-->0) {
			if(sc.nextInt()==1) {
				st.update_Point(sc.nextInt(), sc.nextInt());
			}
			else {
				pw.println(st.query(sc.nextInt(), sc.nextInt()));
			}
		}
	}
    public static void main(String[] args) throws Exception{
        sc=new MScanner(System.in);
        pw = new PrintWriter(System.out);
        int tc=1;
//        tc=sc.nextInt();
        for(int i=1;i<=tc;i++) {
//            pw.printf("Case %d:\n", i);
            main();
        }
        pw.flush();
    }
    static PrintWriter pw;
    static MScanner sc;
    static class MScanner {
        StringTokenizer st;
        BufferedReader br;
        public MScanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }
     
        public MScanner(String file) throws Exception {
            br = new BufferedReader(new FileReader(file));
        }
     
        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public int[] intArr(int n) throws IOException {
            int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
            return in;
        }
        public long[] longArr(int n) throws IOException {
            long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            return in;
        }
        public int[] intSortedArr(int n) throws IOException {
            int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
            shuffle(in);
            Arrays.sort(in);
            return in;
        }
        public long[] longSortedArr(int n) throws IOException {
            long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            shuffle(in);
            Arrays.sort(in);
            return in;
        }
        public Integer[] IntegerArr(int n) throws IOException {
            Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
            return in;
        }
        public Long[] LongArr(int n) throws IOException {
            Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            return in;
        }
        public String nextLine() throws IOException {
            return br.readLine();
        }
     
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
     
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
     
        public char nextChar() throws IOException {
            return next().charAt(0);
        }
     
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
     
        public boolean ready() throws IOException {
            return br.ready();
        }
     
        public void waitForInput() throws InterruptedException {
            Thread.sleep(3000);
        }
        
    }
    static void shuffle(int[]in) {
        for(int i=0;i<in.length;i++) {
            int idx=(int)(Math.random()*in.length);
            int tmp=in[i];
            in[i]=in[idx];
            in[idx]=tmp;
        }
    }
    static void shuffle(long[]in) {
        for(int i=0;i<in.length;i++) {
            int idx=(int)(Math.random()*in.length);
            long tmp=in[i];
            in[i]=in[idx];
            in[idx]=tmp;
        }
    }
}