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.io.InputStreamReader;
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
 */
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 {
	public void solve(int testNumber, InputReader in, PrintWriter out) {
		int n = in.nextInt();
		int m = in.nextInt();

		long[] t1 = new long[n];
		long[] t2 = new long[n];
		TreeSet<Segment> set = new TreeSet<>();
		for (int i = 0; i < n; i++) {
			set.add(new Segment(i, i + 1, i + 1));
		}

		for (int i = 0; i < m; i++) {
			int t = in.nextInt();
			int l = in.nextInt() - 1;
			int r = in.nextInt();
			if (t == 1) {
				int x = in.nextInt();
				while (!set.isEmpty()) {
					Segment s = set.higher(new Segment(l, l, 0));
					if (s == null)
						break;
					int left = Math.max(l, s.a);
					int right = Math.min(r, s.b);
					if (left >= right)
						break;
					add(t1, t2, left, right - 1, Math.abs(s.color - x));
					set.remove(s);
					if (s.a < left) {
						set.add(new Segment(s.a, left, s.color));
					}
					if (s.b > right) {
						set.add(new Segment(right, s.b, s.color));
					}
				}
				set.add(new Segment(l, r, x));
			} else {
				long res = sum(t1, t2, r - 1) - sum(t1, t2, l - 1);
				out.println(res);
			}
		}
	}

	static class Segment implements Comparable<Segment> {
		final int a;
		final int b;
		final int color;

		Segment(int a, int b, int color) {
			this.a = a;
			this.b = b;
			this.color = color;
		}

		public int compareTo(Segment o) {
			return Integer.compare(b, o.b);
		}
	}

	// T[i] += value
	public static void add(long[] t, int i, long value) {
		for (; i < t.length; i |= i + 1)
			t[i] += value;
	}

	// sum[0..i]
	public static long sum(long[] t, int i) {
		long res = 0;
		for (; i >= 0; i = (i & (i + 1)) - 1)
			res += t[i];
		return res;
	}

	// interval add
	public static void add(long[] t1, long[] t2, int a, int b, long value) {
		add(t1, a, value);
		add(t1, b, -value);
		add(t2, a, -value * (a - 1));
		add(t2, b, value * b);
	}

	// interval query
	public static long sum(long[] t1, long[] t2, int i) {
		return sum(t1, i) * i + sum(t2, i);
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

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

	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());
	}
}

