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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author beginner1010
 */
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();
    }

    static class TaskC {
        int n;
        int m;
        node[] segment;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            m = in.nextInt();
            segment = new node[n * 4];
            build(1, n, 1);

            for (int i = 0; i < m; i++) {
                int op = in.nextInt();
                int l = in.nextInt();
                int r = in.nextInt();
                if (op == 1) {
                    int clr = in.nextInt();
                    update(1, n, 1, clr, l, r);
                } else {
                    long ans = query(1, n, 1, l, r);
                    out.println(ans);
                }
            }
        }

        void build(int left, int right, int index) {
            if (left > right)
                return;
            segment[index] = new node(0, false);
            if (left == right) {
                segment[index] = new node(left, true);
                return;
            }
            int mid = (left + right) >> 1;
            build(left, mid, index * 2);
            build(mid + 1, right, index * 2 + 1);
        }

        void propagtion(int index, long left, long right) {
            if (segment[index].hasSameColor == true) {
                segment[index * 2].color = segment[index * 2 + 1].color = segment[index].color;
                segment[index * 2].hasSameColor = segment[index * 2 + 1].hasSameColor = true;
                segment[index * 2].delta += segment[index].delta;
                segment[index * 2 + 1].delta += segment[index].delta;
                long mid = (left + right) >> 1;
                long lenL = mid - left + 1;
                long lenR = right - mid;
                segment[index * 2].sum += lenL * segment[index].delta;
                segment[index * 2 + 1].sum += lenR * segment[index].delta;
                segment[index].delta = 0;
            }
        }

        void update(int left, int right, int index, int color, int a, int b) {
            if (left > right) return;
            if (b < left || right < a) return;
            if (a <= left && right <= b && segment[index].hasSameColor == true) {
                long incr = Math.abs(segment[index].color - color);
                segment[index].delta += incr;
                segment[index].sum += incr * (right - left + 1);
                segment[index].color = color;
            } else {
                int mid = (left + right) >> 1;
                propagtion(index, left, right);
                update(left, mid, index * 2, color, a, b);
                update(mid + 1, right, index * 2 + 1, color, a, b);
                segment[index].sum = segment[index * 2].sum + segment[index * 2 + 1].sum;
                if (a <= left && right <= b) {
                    segment[index].color = color;
                    segment[index].hasSameColor = true;
                } else {
                    segment[index].hasSameColor = false;
                }
            }
            return;
        }

        long query(int left, int right, int index, int a, int b) {
            if (left > right) return 0;
            if (b < left || right < a) return 0;
            if (a <= left && right <= b) return segment[index].sum;
            int mid = (left + right) >> 1;
            propagtion(index, left, right);
            long ansL = query(left, mid, index * 2, a, b);
            long ansR = query(mid + 1, right, index * 2 + 1, a, b);
            segment[index].sum = segment[index * 2].sum + segment[index * 2 + 1].sum;

            return ansL + ansR;
        }

        class node {
            long color;
            boolean hasSameColor;
            long delta;
            long sum;

            node(long color, boolean hasSameColor) {
                this.color = color;
                this.hasSameColor = hasSameColor;
                this.delta = 0L;
                this.sum = 0L;
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}

