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.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Rubanenko
 */
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 {

    class Tuple implements Comparable<Tuple>{
        int l, r, color;
        public int compareTo(Tuple r) {
            return this.l < r.l ? -1 : this.l == r.l ? 0 : 1;
        }
        public Tuple(int l, int r, int color) {
            this.l = l;
            this.r = r;
            this.color = color;
        }
    }

    long[] sum;
    long[] add;


    void push(int v, int l, int r) {
        sum[v] += add[v] * (r - l + 1);
        add[v + v] += add[v];
        add[v + v + 1] += add[v];
        add[v] = 0;
    }

    void addToSegment(int v, int tl, int tr, int l, int r, int value) {
        if (tl > r || l > tr) {
            return;
        }
        if (l <= tl && r >= tr) {
            add[v] += value;
            return;
        }
        push(v, tl, tr);
        int c = (tl + tr) >> 1;
        addToSegment(v + v, tl, c, l, r, value);
        addToSegment(v + v + 1, c + 1, tr, l, r, value);
        sum[v] = sum[v + v] + add[v + v] * (c - tl + 1) + sum[v + v + 1] + add[v + v + 1] * (tr - c);
    }

    long get(int v, int tl, int tr, int l, int r) {
        if (tl > r || l > tr) return 0;
        if (l <= tl && r >= tr) {
            return sum[v] + add[v] * (tr - tl + 1);
        }
        push(v, tl, tr);
        int c = (tl + tr) >> 1;
        long res = get(v + v, tl, c, l, r) + get(v + v + 1, c + 1, tr, l, r);
        sum[v] = sum[v + v] + add[v + v] * (c - tl + 1) + sum[v + v + 1] + add[v + v + 1] * (tr - c);
        return res;
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int sz = 1;
        while (sz < n) {
            sz += sz;
        }
        sum = new long[sz * 2];
        add = new long[sz * 2];
        TreeSet<Tuple> s = new TreeSet<Tuple>();
        for (int i = 1;i <= n; i++) {
            s.add(new Tuple(i, i, i));
        }
        int cnt = 0;
        for (int i = 1; i <= m; i++) {
            int type = in.nextInt();
            int l = in.nextInt();
            int r = in.nextInt();
            if (type == 1) {
                int value = in.nextInt();
                Tuple seek = new Tuple(r, r, 0);
                while (true) {
                    cnt++;
                    if (cnt > (m + n) * 4) {
                        out.println("LOL what?");
                        return;
                    }
                    Tuple tmp = s.floor(seek);
                    if (tmp == null || tmp.r < l) break;
                    s.remove(tmp);
                    int midL = Math.max(l, tmp.l);
                    int midR = Math.min(r, tmp.r);
                    if (tmp.l < midL) {
                        s.add(new Tuple(tmp.l, midL - 1, tmp.color));
                    }
                    if (midR < tmp.r) {
                        s.add(new Tuple(midR + 1, tmp.r, tmp.color));
                    }
//                    if (midL <= midR) {
//                        s.add(new Tuple(midL, midR, value));
                        addToSegment(1, 1, sz, midL, midR, Math.abs(tmp.color - value));
//                    }
                    seek.l = tmp.l - 1;
                    if (seek.l < l) break;
                }
                s.add(new Tuple(l, r, value));
            }
            else {
                out.println(get(1, 1, sz, l, r));
            }
        }

    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
    }

    public String nextLine() {
        String line = null;
        try {
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return line;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(nextLine());
        return tokenizer.nextToken();
    }

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

