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.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author George Marcus
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    long[] Aint;
    long[] Aupd;
    int a, b, c;
    int qa, qb, qc;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int N = in.nextInt();
        int M = in.nextInt();

        Aint = new long[4 * N];
        Aupd = new long[4 * N];

        TreeSet<int[]> set = new TreeSet<int[]>(
            new Comparator<int[]>() {
                @Override
                public int compare(int[] o1, int[] o2) {
                    if (o1[0] != o2[0]) {
                        return o1[0] < o2[0] ? -1 : 1;
                    }
                    if (o1[1] != o2[1]) {
                        return o1[1] < o2[1] ? -1 : 1;
                    }
                    return 0;
                }
            }
        );
        for (int i = 0; i < N; i++) {
            set.add(new int[] { i, i, i + 1 });
        }

        for (int i = 0; i < M; i++) {
            int t = in.nextInt();
            a = in.nextInt();
            b = in.nextInt();
            a--; b--;
            if (t == 1) {
                c = in.nextInt();

                int[] seg = set.lower(new int[] { a, N, -1 });

                ArrayList<int[]> newSegments = new ArrayList<int[]>();
                while (seg != null && seg[0] <= b) {
                    set.remove(seg);

                    qc = Math.abs(seg[2] - c);
                    if (a <= seg[0] && seg[1] <= b) {
                        qa = seg[0];
                        qb = seg[1];
                        update(1, 0, N - 1);
                    }
                    else {
                        if (seg[0] < a) {
                            newSegments.add(new int[] { seg[0], a - 1, seg[2] });
                            qa = a;
                            qb = Math.min(b, seg[1]);
                            update(1, 0, N - 1);
                        }
                        if (seg[1] > b) {
                            newSegments.add(new int[] { b + 1, seg[1], seg[2] });
                            if (a <= seg[0]) {
                                qa = seg[0];
                                qb = b;
                                update(1, 0, N - 1);
                            }
                        }
                    }

                    seg = set.higher(seg);
                }

                for (int[] s : newSegments) {
                    set.add(s);
                }
                set.add(new int[] { a, b, c });
            }
            else {
                qa = a;
                qb = b;
                long q = query(1, 0, N - 1);
                out.println(q);
            }
        }
    }

    private long query(int k, int st, int dr) {
        if (qa <= st && dr <= qb) {
            return Aint[k];
        }

        int m = (st + dr) / 2;

        if (Aupd[k] != 0) {
            Aupd[2 * k] += Aupd[k];
            Aupd[2 * k + 1] += Aupd[k];
            Aint[2 * k] += (m - st + 1) * Aupd[k];
            Aint[2 * k + 1] += (dr - m) * Aupd[k];
            Aupd[k] = 0;
        }

        long ret = 0;
        if (qa <= m) {
            ret += query(2 * k, st, m);
        }
        if (m < qb) {
            ret += query(2 * k + 1, m + 1, dr);
        }

        return ret;
    }

    private void update(int k, int st, int dr) {
        if (qa <= st && dr <= qb) {
            Aint[k] += (long) (dr - st + 1) * qc;
            Aupd[k] += qc;
            return;
        }

        int m = (st + dr) / 2;

        if (Aupd[k] != 0) {
            Aupd[2 * k] += Aupd[k];
            Aupd[2 * k + 1] += Aupd[k];
            Aint[2 * k] += (m - st + 1) * Aupd[k];
            Aint[2 * k + 1] += (dr - m) * Aupd[k];
            Aupd[k] = 0;
        }

        if (qa <= m) {
            update(2 * k, st, m);
        }
        if (qb > m) {
            update(2 * k + 1, m + 1, dr);
        }

        Aint[k] = Aint[2 * k] + Aint[2 * k + 1];
    }

}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));

        return res.toString();
    }

    private boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

}

