DZY loves colors, and he enjoys painting.

On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of the i-th unit of the ribbon is i at first. It is colorful enough, but we still consider that the colorfulness of each unit is 0 at first.

DZY loves painting, we know. He takes up a paintbrush with color x and uses it to draw a line on the ribbon. In such a case some contiguous units are painted. Imagine that the color of unit i currently is y. When it is painted by this paintbrush, the color of the unit becomes x, and the colorfulness of the unit increases by |x - y|.

DZY wants to perform m operations, each operation can be one of the following:

  1. Paint all the units with numbers between l and r (both inclusive) with color x. 
  2. Ask the sum of colorfulness of the units between l and r (both inclusive). 



Can you help DZY?

Input

The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105).

Each of the next m lines begins with a integer type (1 ≤ type ≤ 2), which represents the type of this operation.

If type = 1, there will be 3 more integers l, r, x (1 ≤ l ≤ r ≤ n; 1 ≤ x ≤ 108) in this line, describing an operation 1.

If type = 2, there will be 2 more integers l, r (1 ≤ l ≤ r ≤ n) in this line, describing an operation 2.

Output

For each operation 2, print a line containing the answer — sum of colorfulness.

Examples

Input

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


Output

8


Input

3 4
1 1 3 4
2 1 1
2 2 2
2 3 3


Output

3
2
1


Input

10 6
1 1 5 3
1 2 7 9
1 10 10 11
1 3 8 12
1 1 10 3
2 1 10


Output

129

Note

In the first sample, the color of each unit is initially [1, 2, 3], and the colorfulness is [0, 0, 0].

After the first operation, colors become [4, 4, 3], colorfulness become [3, 2, 0].

After the second operation, colors become [4, 5, 5], colorfulness become [3, 3, 2].

So the answer to the only operation of type 2 is 8.
import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.util.Collections.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.math.BigInteger.*;


public class Main{

    void run(){
        Locale.setDefault(Locale.US);
        boolean my;
        try {
            my = System.getProperty("MY_LOCAL") != null;
        } catch (Exception e) {
            my = false;
        }
        try{
            err = System.err;
            if( my ){
                sc  = new FastScanner(new BufferedReader(new FileReader("input.txt")));
//                sc  = new FastScanner(new BufferedReader(new FileReader("C:\\myTest.txt")));
                out = new PrintWriter   (new FileWriter("output.txt"));
            }
            else {
                sc = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }
//            out = new PrintWriter(new OutputStreamWriter(System.out));
        }catch(Exception e){
            MLE();
        }
        if( my )
            tBeg = System.currentTimeMillis();
        solve();
        if( my )
            err.println( "TIME: " + (System.currentTimeMillis() - tBeg ) / 1e3 );
        exit(0);
    }

    void exit( int val ){
        err.flush();
        out.flush();
        System.exit(val);
    }

    double tBeg;
    FastScanner sc;
    PrintWriter out;
    PrintStream err;

    class FastScanner{

        StringTokenizer st;
        BufferedReader br;

        FastScanner( BufferedReader _br ){
            br = _br;
        }

        String readLine(){
            try {
                return br.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        String next(){
            while( st==null || !st.hasMoreElements() )
                st = new StringTokenizer(readLine());
            return st.nextToken();
        }

        int nextInt(){ return Integer.parseInt(next()); }
        long nextLong(){ return Long.parseLong(next()); }
        double nextDouble(){ return Double.parseDouble(next()); }
    }

    void MLE(){
        int[][] arr = new int[1024*1024][]; for( int i = 0; i < 1024*1024; ++i ) arr[i] = new int[1024*1024];
    }

    void MLE( boolean doNotMLE ){ if( !doNotMLE ) MLE(); }

    void TLE(){
        for(;;);
    }

    public static void main(String[] args) {
        new Main().run();
//        new Thread( null, new Runnable() {
//            @Override
//            public void run() {
//                new Main().run();
//            }
//        }, "Lolka", 256_000_000L ).run();
    }

    ////////////////////////////////////////////////////////////////

    class Adder{
        int n;
        long[] sum, add;

        Adder( int _n ){
            n = _n;
            sum = new long[4*n];
            add = new long[4*n];
        }

        long getVal( int v, int tl, int tr ){
            return sum[v] + (tr - tl + 1) * add[v];
        }

        void add( int delta, int l, int r ){
            add( delta, l, r, 1,0,n-1 );
        }

        void add( long delta, int l, int r, int v, int  tl, int tr ){
            if( l > r ) return;
            if( l == tl && r == tr ){
                add[v] += delta;
            }
            else{
//                sum[v] = getVal(v,tl,tr);
                add[2*v  ] += add[v];
                add[2*v+1] += add[v];
                add[v] = 0;

                int tm = (tl + tr) / 2;
                add( delta,           l, min(r,tm), 2*v  ,   tl, tm );
                add( delta, max(tm+1,l),         r, 2*v+1, tm+1, tr );
                sum[v] = getVal(2*v,tl,tm) + getVal(2*v+1,tm+1,tr);
            }
        }

        long getSum( int l, int r ){
            return getSum( l, r, 1,0,n-1 );
        }

        long getSum( int l, int r, int v, int tl, int tr ){
            if( l > r ) return 0;
            if( l == tl && r == tr ){
                return getVal(v,tl,tr);
            }
            else{
                sum[v] = getVal(v,tl,tr);
                add[2*v  ] += add[v];
                add[2*v+1] += add[v];
                add[v] = 0;

                int tm = (tl + tr) / 2;
                return
                    getSum(           l, min(r,tm), 2*v  ,   tl, tm ) +
                    getSum( max(tm+1,l),         r, 2*v+1, tm+1, tr );
            }
        }
    }

    class Painter{
        int n;
        int[] color;
        Adder add;

        Painter( int _n ){
            n = _n;
            color = new int[4*n];
            fill( color, -1 );
            build( 1,0,n-1 );
            add = new Adder(n);
        }


        void build( int v, int tl, int tr ){
            if( tl == tr ){
                color[v] = tl;
            }
            else{
                int tm = (tl + tr) / 2;
                build( 2*v  ,   tl, tm );
                build( 2*v+1, tm+1, tr );
                color[v] = -1;
            }
        }

        void pain( int clr, int l, int r ){
            pain( clr, l, r, 1,0,n-1 );
        }

        void pain( int clr, int l, int r, int v, int  tl, int tr ){
            if( l > r ) return;
            if( l == tl && r == tr && color[v] != -1 ){
                add.add( abs( color[v] - clr ), l, r );
//                err.printf( "%2d %2d: %2d\n", l, r, abs( color[v] - clr ) );
                color[v] = clr;
            }
            else{
                if( color[v] != -1 ){
                    color[2*v] = color[2*v+1] = color[v];
                }
                int tm = (tl + tr) / 2;
                pain( clr,           l, min(r,tm), 2*v  ,   tl, tm );
                pain( clr, max(tm+1,l),         r, 2*v+1, tm+1, tr );
                color[v] = color[2*v] == color[2*v+1]? color[2*v] : -1;
            }
        }
    }

    void solve(){
        int n, m;
        Painter paint;

        n = sc.nextInt();
        m = sc.nextInt();
        paint = new Painter(n+1);

        for (int iter = 0; iter < m; iter++) {
            int op = sc.nextInt();
            if     ( op == 1 ){
                int l = sc.nextInt();
                int r = sc.nextInt();
                int x = sc.nextInt();
                paint.pain(x,l,r);
            }
            else if( op == 2 ){
                int l = sc.nextInt();
                int r = sc.nextInt();
                out.println( paint.add.getSum(l,r) );
            }
            else
                MLE();
        }
    }


}