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.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vadim
 */
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);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
    void updateSum(AddSumSegmentTreeLong sumTree, ColorSegmentTree colorTree, int v, int tl, int tr, int l, int r, int color) {
        if (l > r)
            return;
        if(colorTree.t[v] != -1) {
            sumTree.modify(l, r, Math.abs(color-colorTree.t[v]));
            return;
        }

        int tm = (tl + tr) / 2;
        updateSum(sumTree, colorTree, v * 2, tl, tm, l, Math.min(r, tm), color);
        updateSum(sumTree, colorTree, v * 2 + 1, tm + 1, tr, Math.max(l, tm + 1), r, color);
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.ni();
        int m = in.ni();
        AddSumSegmentTreeLong sumTree = new AddSumSegmentTreeLong(n);
        ColorSegmentTree colorTree = new ColorSegmentTree(n);
        for (int i = 0; i < n; i++) {
            colorTree.update(i,i,i+1);
        }
        for (int i = 0; i < m; i++) {
            int t = in.ni();
            int l = in.ni()-1;
            int r = in.ni()-1;
            if(t == 1) {
                int x = in.ni();
                updateSum(sumTree, colorTree, 1, 0, n - 1, l, r, x);
                colorTree.update(l, r, x);
            } else {
                out.println(sumTree.query(l, r));
            }
        }

    }


}

class AddSumSegmentTreeLong {

    // Modify the following 5 methods to implement your custom operations on the tree.
    // This example implements Add/Max operations. Operations like Add/Sum, Set/Max can also be implemented.
    long modifyOperation(long x, long y) {
        return x + y;
    }

    // query (or combine) operation
    long queryOperation(long leftValue, long rightValue) {
        return leftValue + rightValue;
    }

    long deltaEffectOnSegment(long delta, int segmentLength) {
        // Here you must write a fast equivalent of following slow code:
        // int result = delta;
        // for (int i = 1; i < segmentLength; i++) result = queryOperation(result, delta);
        // return result;
        return delta*segmentLength;
    }

    long getNeutralDelta() {
        return 0;
    }

    long getInitValue() {
        return 0;
    }

    // generic code
    int n;
    long[] value;
    long[] delta; // delta[i] affects value[i], delta[2*i+1] and delta[2*i+2]

    long joinValueWithDelta(long value, long delta) {
        if (delta == getNeutralDelta()) return value;
        return modifyOperation(value, delta);
    }

    long joinDeltas(long delta1, long delta2) {
        if (delta1 == getNeutralDelta()) return delta2;
        if (delta2 == getNeutralDelta()) return delta1;
        return modifyOperation(delta1, delta2);
    }

    void pushDelta(int root, int left, int right) {
        value[root] = joinValueWithDelta(value[root], deltaEffectOnSegment(delta[root], right - left + 1));
        delta[2 * root + 1] = joinDeltas(delta[2 * root + 1], delta[root]);
        delta[2 * root + 2] = joinDeltas(delta[2 * root + 2], delta[root]);
        delta[root] = getNeutralDelta();
    }

    public AddSumSegmentTreeLong(int n) {
        this.n = n;
        value = new long[4 * n];
        delta = new long[4 * n];
        init(0, 0, n - 1);
    }

    void init(int root, int left, int right) {
        if (left == right) {
            value[root] = getInitValue();
            delta[root] = getNeutralDelta();
        } else {
            int mid = (left + right) >> 1;
            init(2 * root + 1, left, mid);
            init(2 * root + 2, mid + 1, right);
            value[root] = queryOperation(value[2 * root + 1], value[2 * root + 2]);
            delta[root] = getNeutralDelta();
        }
    }

    public long query(int from, int to) {
        return query(from, to, 0, 0, n - 1);
    }

    long query(int from, int to, int root, int left, int right) {
        if (from == left && to == right)
            return joinValueWithDelta(value[root], deltaEffectOnSegment(delta[root], right - left + 1));
        pushDelta(root, left, right);
        int mid = (left + right) >> 1;
        if (from <= mid && to > mid)
            return queryOperation(
                    query(from, Math.min(to, mid), root * 2 + 1, left, mid),
                    query(Math.max(from, mid + 1), to, root * 2 + 2, mid + 1, right));
        else if (from <= mid)
            return query(from, Math.min(to, mid), root * 2 + 1, left, mid);
        else if (to > mid)
            return query(Math.max(from, mid + 1), to, root * 2 + 2, mid + 1, right);
        else
            throw new RuntimeException("Incorrect query from " + from + " to " + to);
    }

    public void modify(int from, int to, int delta) {
        modify(from, to, delta, 0, 0, n - 1);
    }

    void modify(int from, int to, int delta, int root, int left, int right) {
        if (from == left && to == right) {
            this.delta[root] = joinDeltas(this.delta[root], delta);
            return;
        }
        pushDelta(root, left, right);
        int mid = (left + right) >> 1;
        if (from <= mid)
            modify(from, Math.min(to, mid), delta, 2 * root + 1, left, mid);
        if (to > mid)
            modify(Math.max(from, mid + 1), to, delta, 2 * root + 2, mid + 1, right);
        value[root] = queryOperation(
                joinValueWithDelta(value[2 * root + 1], deltaEffectOnSegment(this.delta[2 * root + 1], mid - left + 1)),
                joinValueWithDelta(value[2 * root + 2], deltaEffectOnSegment(this.delta[2 * root + 2], right - mid)));
    }

}

class ColorSegmentTree {
    public int n;
    public int t[];

    void push (int v) {
        if (t[v] != -1) {
            t[v*2] = t[v*2+1] = t[v];
            t[v] = -1;
        }
    }

    public void update (int l, int r, int color) {
        update(1, 0, n-1, l, r, color);
    }

    private void update (int v, int tl, int tr, int l, int r, int color) {
        if (l > r)
            return;
        if (l == tl && tr == r)
            t[v] = color;
        else {
            push (v);
            int tm = (tl + tr) / 2;
            update (v*2, tl, tm, l, Math.min(r, tm), color);
            update (v*2+1, tm+1, tr, Math.max(l, tm + 1), r, color);
        }
    }

    public ColorSegmentTree(int n) {
        this.n = n;
        t = new int[4 * n];
        Arrays.fill(t, -1);
    }
}

class InputReader  extends BufferedReader {
    public InputReader(InputStream st) {
        super(new InputStreamReader(st));
    }

    public int nextInt() {
        try {
            int c = read();

            while (isWhiteSpace(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int ret = 0;
            while (c >= 0 && !isWhiteSpace(c)) {
                if (c < '0' || c > '9') {
                    throw new RuntimeException();
                }
                ret = ret * 10 + c - '0';
                c = read();
            }
            return ret * sgn;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public int ni() {
        return nextInt();
    }

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


    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }



}
