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

public class E {

    static PrintWriter pw;

    void solve(int n, int q, int[] a, int[][] g) {
//        tr(n, q, a);
//        tr(g);
        SegmentTree st = new SegmentTree(0, n - 1);
        for (int i = 0; i < n - 1; i++) {
            if (a[i] > a[i + 1]) st.pointUpdate(i, true);
        }
        for (int[] e : g) {
            int type = e[0];
            if (type == 1) {
                int position = e[1] - 1, value = e[2];
                a[position] = value;
                if (position != 0) st.pointUpdate(position - 1, a[position] < a[position - 1]);
                if (position != n - 1) st.pointUpdate(position, a[position + 1] < a[position]);
            } else {
                int l = e[1] - 1, r = e[2] - 1;
                long res = st.rangeQuery(l, r).value();
                pr(res);
            }
        }
    }

    Data combine(Data l, Data r) {
        if (l == null) return r;
        if (r == null) return l;
        int newSize = l.size + r.size;
        int newL = -1;
        int newR = -1;
        long newM = -1;
        if (l.uninterrupted()) {
            newM = r.middleSum;
            newL = l.size + r.leftStraight;
        } else {
            newL = l.leftStraight;
        }
        if (r.uninterrupted()) {
            newR = r.size + l.rightStraight;
            newM = l.middleSum;
        } else {
            newR = r.rightStraight;
        }
        if (newM == -1) {
            newM = l.middleSum + r.middleSum + cal(l.rightStraight + r.leftStraight);
        }
        Data ans = new Data(newL, newR, newSize, newM);
        return ans;
    }

    long cal(int n) {
        return n * (long) (n + 1) / 2;
    }

    class SegmentTree {
        int leftmost, rightmost;
        SegmentTree lChild, rChild;
        Data data;

        public SegmentTree(int l, int r) {
            this.leftmost = l;
            this.rightmost = r;
            if (l != r) {
                int mid = (l + r) / 2;
                lChild = new SegmentTree(l, mid);
                rChild = new SegmentTree(mid + 1, r);
                recalculate();
            } else {
                data = new Data(1, 1, 1, 0);
            }
        }

        void pointUpdate(int position, boolean isCutPoint) {
            if (leftmost == rightmost) {
                data = new Data(1, isCutPoint ? 0 : 1, 1, 0);
                return;
            }
            if (position <= lChild.rightmost) {
                lChild.pointUpdate(position, isCutPoint);
            } else {
                rChild.pointUpdate(position, isCutPoint);
            }
            recalculate();
        }

        Data rangeQuery(int l, int r) {
            if (l > rightmost || r < leftmost) return null;
            if (l <= leftmost && r >= rightmost) return data;
            Data lRes = lChild.rangeQuery(l, r);
            Data rRes = rChild.rangeQuery(l, r);
            return combine(lRes, rRes);
        }

        void recalculate() {
            if (leftmost == rightmost) return;
            data = combine(lChild.data, rChild.data);
        }
    }

    class Data {
        int leftStraight, rightStraight, size;
        long middleSum;

        public Data(int leftStraight, int rightStraight, int size, long middleSum) {
            this.leftStraight = leftStraight;
            this.rightStraight = rightStraight;
            this.size = size;
            this.middleSum = middleSum;
        }

        long value() {
            if (size == leftStraight) return cal(leftStraight);
            return middleSum + cal(leftStraight) + cal(rightStraight);
        }

        boolean uninterrupted() {
            return rightStraight == size;
        }

        public String toString() {
            return "{ " + leftStraight + " ... " + middleSum + " ... " + rightStraight + " } size: " + size;
        }
    }

    private void run() {
        // read_write_file(); // comment this before submission
        FastScanner fs = new FastScanner();
        int t = 1;
        while (t-- > 0) {
            int n = fs.nextInt();
            int q = fs.nextInt();
            int[] a = fs.readArray(n);
            int[][] g = new int[q][3];
            for (int i = 0; i < q; i++) {
                for (int j = 0; j < 3; j++) {
                    g[i][j] = fs.nextInt();
                }
            }
            solve(n, q, a, g);
        }
    }

    private final String INPUT = "input.txt";
    private final String OUTPUT = "output.txt";

    void read_write_file() {
        FileInputStream instream = null;
        PrintStream outstream = null;
        try {
            instream = new FileInputStream(INPUT);
            outstream = new PrintStream(new FileOutputStream(OUTPUT));
            System.setIn(instream);
            System.setOut(outstream);
        } catch (Exception e) {
        }
    }

    public static void main(String[] args) {
        pw = new PrintWriter(System.out);
        new E().run();
        pw.close();
    }

    void pr(int num) {
        pw.println(num);
    }

    void pr(long num) {
        pw.println(num);
    }

    void pr(double num) {
        pw.println(num);
    }

    void pr(String s) {
        pw.println(s);
    }

    void pr(char c) {
        pw.println(c);
    }

    class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        Integer[] readIntegerArray(int n) {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    void tr(Object... o) {
        pw.println(Arrays.deepToString(o));
    }
}