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.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;
	
	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}
	
	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}
	
	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}
	
	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}
	
	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		
		int n = nextInt(), m = nextInt();
		LazySegmentTree tree = new LazySegmentTree(n);
		TreeSet<Segment> set = new TreeSet<Segment>();

		for(int i=0;i<n;i++){
			set.add(new Segment(i, i, i+1));
		}

		for(int i=0;i<m;i++){
			int type = nextInt(), l = nextInt()-1, r = nextInt()-1;
			if (type == 1) {
				int val = nextInt();
				Segment x = new Segment(l, r, val);
				
				Segment y = set.lower(x);
				if (y != null && y.to >= x.from) {
					set.remove(y);
					set.add(new Segment(y.from, x.from-1, y.color));
					set.add(new Segment(x.from, y.to, y.color));
				}

				while(true) {
					y = set.ceiling(x);
					if (y == null) break;
					if (y.from > x.to) break;
					set.remove(y);

					if (y.to > x.to) {
						set.add(new Segment(x.to + 1, y.to, y.color));
						y.to = x.to;
					}

					tree.update(1, 0, n-1, y.from, y.to, Math.abs(y.color - x.color));
				}

				set.add(x);

			}else {
				long x = tree.sum(1, 0, n-1, l, r);
				out.println(x);
			}
		}

		out.close();
	}

	class Segment implements Comparable<Segment>{
		int from, to, color;
		public Segment(int from, int to, int color) {
			this.from = from;
			this.to = to;
			this.color = color;
		}

		public int compareTo(Segment other) {
			if (from < other.from) return -1;
			if (from > other.from) return 1;
			return 0;
		}

		@Override
		public String toString() {
			return this.from + " " + this.to + " " + this.color;
		}
	}

	class LazySegmentTree {
		long []add, sum;
		public LazySegmentTree(int x) {
			int size = Integer.highestOneBit(x) << 2;
			add = new long[size];
			sum = new long[size];
		}

		private void push(int v, int tl, int tr) {
			if (add[v] != 0) {
				int tm = (tl + tr) >> 1;
				add[2*v]+=add[v];
				sum[2*v]+=1L * (tm - tl + 1) * add[v];
				add[2*v+1]+=add[v];
				sum[2*v+1]+=1L * (tr - tm) * add[v];
			}
			add[v] = 0;
		}

		public void update(int v, int tl, int tr, int l, int r, int d) {
			if (l > r) return;
			if (tl == l && tr == r) {
				add[v]+=d;
				sum[v]+=1L * (r - l + 1) * d;
				return;
			}

			push(v, tl, tr);
			int tm = (tl + tr) >> 1;
			update(2*v, tl, tm, l, Math.min(tm, r), d);
			update(2*v+1, tm+1, tr, Math.max(l, tm+1), r, d);

			sum[v] = sum[2*v] + sum[2*v+1];
		}

		public long sum(int v, int tl, int tr, int l, int r) {
			if (l > r) return 0;
			if (tl == l && tr == r) {
				return sum[v];
			}

			push(v, tl, tr);
			int tm = (tl + tr) >> 1;
			long left = sum(2*v, tl, tm, l, Math.min(tm, r));
			long right = sum(2*v+1, tm+1, tr, Math.max(l, tm+1), r);

			return left + right;
		}
	}
	
	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
