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.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class C {
	public static void main(String[] args) throws Exception{
		int n = readInt();
		int m = readInt();
		Tree st = new Tree(2*n);
		TreeSet<Interval> t = new TreeSet<Interval>();
		for(int i = 0; i <=n; i++){
			t.add(new Interval(i, i, i));
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < m; i++){
			int type = readInt();
			if(type == 1){
				int l = readInt();
				int r = readInt();
				long x = readLong();
				Interval temp = new Interval(l, -1, 0);
				Interval before = t.lower(temp);
				if(before != null){
					if(before.end >= l){
						st.add(l, Math.min(before.end,  r),  Math.abs(x-before.color));

						if(before.start < l){
							t.add(new Interval(before.start, l-1, before.color));
						}
						if(before.end > r){
							t.add(new Interval(r+1, before.end, before.color));
						}
						t.remove(before);
					}
				}
				while(t.higher(temp) != null){
					Interval next = t.higher(temp);
					if(next.start <= r){
						st.add(next.start, Math.min(next.end, r), Math.abs(x-next.color));
						if(next.end > r){
							t.add(new Interval(r+1, next.end, next.color));
						}
						t.remove(next);
					}
					else{
						break;
					}
				}
				t.add(new Interval(l, r, x));

			}
			else if(type == 2){
				int l = readInt();
				int r = readInt();
				sb.append(st.getSum(l, r));
				sb.append('\n');
			}
		}

		System.out.print(sb);

	}

	static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st = new StringTokenizer(" ");
	static String readString() throws Exception{
		while(!st.hasMoreTokens()){
			st = new StringTokenizer(stdin.readLine());
		}
		return st.nextToken();
	}
	static int readInt() throws Exception {
		return Integer.parseInt(readString());
	}
	static long readLong() throws Exception {
		return Long.parseLong(readString());
	}
	static class Interval implements Comparable<Interval>{
		int start;
		int end;
		long color;
		Interval(int a, int b, long c){
			start = a;
			end = b;
			color = c;
		}
		@Override
		public int compareTo(Interval o) {
			if(this.start < o.start){
				return -1;
			}
			if(this.start > o.start){
				return 1;
			}
			if(this.end < o.end){
				return -1;
			}
			if(this.end > o.end){
				return 1;
			}
			return 0;
		}
	}

	static class Tree {

		private int OFFSET = 300000; // This may have to be increased for big input
		private long bonus[];
		private long tree[];

		/**
		 * Returns: sum in interval [l,r]
		 */
		public long getSum(int l, int r){
			l+=OFFSET-1; r+=OFFSET+1; 
			ArrayList<Integer> left = new ArrayList<Integer>(); 
			ArrayList<Integer> right = new ArrayList<Integer>();
			while ((l>>1)!=(r>>1)) {
				left.add(l); right.add(r);
				l>>=1; r>>=1;
			}
			int root=(l>>1); 
			long bs=0;
			while (l>>1 != 0) {
				bs+=bonus[l>>1]; // bs = Math.max(bs,bonus[l>>1]);
				l>>=1;
			}
			long lbonus=bs+bonus[root<<1]; // int lbonus = Math.max(bs,bonus[root<<1]);      
			long rbonus=bs+bonus[(root<<1)+1]; // int rbonus = Math.max(bs,bonus[(root<<1)+1]);
			long result=0;
			for(int i = left.size()-1; i >= 0; i--){                                 
				if (!(left.get(i)%2 == 1)){
					result+=((lbonus+bonus[left.get(i)^1])<<i)+tree[left.get(i)^1];
					// result = Math.max(result,Math.max(tree[left.get(i)^1],lbonus));
				}                                   
				if ( (right.get(i)%2 ==1)){
					result+=((rbonus+bonus[right.get(i)^1])<<i)+tree[right.get(i)^1];
					// result = Math.max(result,Math.max(tree[right.get(i)^1],rbonus));
				}
				lbonus+=bonus[left.get(i)]; // lbonus = Math.max(lbonus,bonus[left.get(i)]); 
				rbonus+=bonus[right.get(i)]; // rbonus = Math.max(rbonus,bonus[right.get(i)]);
			}
			return result;
		}

		/**
		 * Adds v to all cells in interval [l,r]
		 */
		public void add(int l, int r, long m){
			l+=OFFSET-1; r+=OFFSET+1;
			long chunk=0,lcount=0,rcount=0;
			while ((l>>1)!=(r>>1)){
				if (!(l%2 == 1)) {  
					bonus[l^1]+=m;
					lcount+=m<<chunk;
				} // Substitute whole block with: {tree[l^1]=v; bonus[l^1]=v;}
				if ( (r%2 == 1)) { 
					bonus[r^1]+=m;
					rcount+=m<<chunk;
				} // {tree[r^1]=v; bonus[r^1]=v;}
				tree[l>>1]+=lcount; // tree[l>>1] = Math.max(bonus[l>>1], Math.max(tree[l],tree[l^1]));
				tree[r>>1]+=rcount; // tree[r>>1] = Math.max(bonus[r>>1], Math.max(tree[r],tree[r^1]));
				l>>=1; r>>=1; chunk++;
			}
			lcount+=rcount;
			while ((l >> 1 != 0)) {
				tree[l>>1]+=lcount; // tree[l>>1] = Math.max(bonus[l>>1], Math.max(tree[l],tree[l^1]));
				l>>=1;
			}
		}

		/**
		 * Constructor using specified OFFSET
		 */
		public Tree(){
			bonus = new long[OFFSET*2];
			tree = new long[OFFSET*2];
		}

		/**
		 * Constructor using n - the size of the array.
		 */
		public Tree(int n){
			OFFSET = n+1;
			bonus = new long[OFFSET*2];
			tree = new long[OFFSET*2];
		}
	}
}
