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.*;
import java.util.*;
/*
 * Heart beats fast
 * 		Colors and promises
 * 			How to be brave
 * 				How can I love when I am afraid...
 */
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
//always declare multidimensional arrays as [2][n] not [n][2]
//it can lead to upto 2-3x diff in runtime
//declare int/long tries with 16 array size due to object overhead :D
public class Main
{
	static class segtree
	{
		//segment tree
		
		//n is segment tree size
		//take input from i=n to 2*n-1
		int n,ln;
		long[]tr;
		long[]lazy;
		void apply(int ind, long val)
		{
			tr[ind]+=val;
			if(ind<n)
				lazy[ind]+=val;
		}
		void push(int ind) {
			for(int s=ln; s>0; s--) {
				int i= ind>>s;
				if(lazy[i]!=0)
				{
					apply(i<<1,lazy[i]/2);
					apply(i<<1|1,lazy[i]/2);
					lazy[i]=0;
				}
			}
		}
		void build()
		{
			for(int i=n-1; i>0; i--)
				tr[i]=tr[i<<1]+tr[i<<1|1];
		}
		 void build(int p) {
			  while (p > 1) {
				  p>>=1;
				  tr[p] =tr[p<<1]+tr[p<<1|1];
				}
		}
		 void update(int l, int r,long val) {
			  l += n;
			  r += n;
			  int l0 = l, r0 = r-1;
			  for (; l < r; l >>= 1, r >>= 1) {
			    if ((l&1)!=0) {
			    	apply(l++,val);
			    }
			    if ((r&1)!=0) {
			    	apply(--r,val);
			    }
			    val*=2;
			  }
			  push(l0);
			  push(r0);
			  build(l0);
			  build(r0);
			}
		 long query(int l, int r) {
			  l += n;
			  r += n;
			  push(l);
			  push(r-1);
			  long res = 0;
			  for ( ;l<r; l >>= 1, r >>= 1) {
			    if ((l&1)!=0) res +=tr[l++];
			    if ((r&1)!=0) res +=tr[--r];
			  }
			  return res;
			}
	}
	public static void main(String[] args) throws Exception
	{
		int n=ni(),m=ni();
		long time=System.currentTimeMillis();
		segtree a=new segtree();
		a.n=n;
		a.tr=new long[2*n];
		a.lazy=new long[2*n];
		a.ln=32-Integer.numberOfLeadingZeros(n-1);
		NavigableMap<Integer,pair> hola=new TreeMap<Integer,pair>();
		for(int i=0; i<n; i++)
			hola.put(i, new pair(i+1,i+1));
		while(m-->0)
		{
			
			if(ni()==1)
			{
				int l=ni()-1,r=ni(),x=ni();
				Map.Entry<Integer, pair> te=hola.floorEntry(l);
				int lol=l;
				if(te.getKey()<l)
				{
					pair holol=te.getValue();
					int temp=te.getKey();
					hola.remove(te.getKey());
					hola.put(temp,new pair(l,holol.b));
					hola.put(l,new pair(holol.a,holol.b));
				}
//				sop("huha");
				while(l<r)
				{
//					sop("huh");
					pair temp=hola.get(l);
					if(temp.a<=r)
					{
						a.update(l, temp.a, Math.abs(temp.b-x));
						int lul=temp.a;
						hola.remove(l);
						l=lul;
					}
					else
					{
						a.update(l, r, Math.abs(temp.b-x));
						int lul=temp.a;
						int ll=temp.b;
						hola.remove(l);
						l=r;
						hola.put(r, new pair(lul,ll));
					}
				}
				hola.put(lol, new pair(r,x));
			}
			else
			{
				int l=ni()-1,r=ni();
				pr(a.query(l, r));
			}
			errorbuffer=new StringBuilder();
		}
		
		System.out.print(output);
	}
	static StringBuilder errorbuffer=new StringBuilder();
	///////////////////////////////////////////
	///////////////////////////////////////////
	///template from here
	static class pair
	{
		int a, b;
		pair(){}
		pair(int c,int d){a=c;b=d;}
	}
	static interface combiner
	{
		public int combine(int a, int b);
	}
	static final int mod=1000000007;
	static final double eps=1e-9;
	static final long inf=100000000000000000L;
	static Reader in=new Reader();
	static StringBuilder output=new StringBuilder();
	static Random rn=new Random();
	static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}}
	static int log2n(long a)
	{
		int te=0;
		while(a>0)
		{
			a>>=1;
			++te;
		}
		return te;
	}
	static class vectorl implements Iterable<Long>
	{
		long a[];
		int size;
		vectorl(){a=new long[10];size=0;}
		vectorl(int n){a=new long[n];size=0;}
		public void add(long b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}
		public void sort(){Arrays.sort(a, 0, size);}
		public void sort(int l, int r){Arrays.sort(a, l, r);}
		@Override
		public Iterator<Long> iterator() {
			Iterator<Long> hola=new Iterator<Long>()
					{
				int cur=0;
						@Override
						public boolean hasNext() {
							return cur<size;
						}
						@Override
						public Long next() {
							return a[cur++];
						}				
					};
			return hola;
		}
	}
	static class vector implements Iterable<Integer>
	{
		int a[],size;
		vector(){a=new int[10];size=0;}
		vector(int n){a=new int[n];size=0;}
		public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}
		public void sort(){Arrays.sort(a, 0, size);}
		public void sort(int l, int r){Arrays.sort(a, l, r);}
		@Override
		public Iterator<Integer> iterator() {
			Iterator<Integer> hola=new Iterator<Integer>()
					{
				int cur=0;
						@Override
						public boolean hasNext() {
							return cur<size;
						}
						@Override
						public Integer next() {
							return a[cur++];
						}				
					};
			return hola;
		}
	}
	//output functions////////////////
	static void pr(Object a){output.append(a+"\n");}
	static void pr(){output.append("\n");}
	static void p(Object a){output.append(a);}
	static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");}
	static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");}
	static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");}
	static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");}
	static void sop(Object a){System.out.println(a);}
	static void flush(){System.out.print(output);output=new StringBuilder();}
	//////////////////////////////////
	//input functions/////////////////
	static int ni(){return Integer.parseInt(in.next());}
	static long nl(){return Long.parseLong(in.next());}
	static String ns(){return in.next();}
	static double nd(){return Double.parseDouble(in.next());}
	static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;}
	static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;}
	static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;}
	static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;}
	static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;}
	//////////////////////////////////
	//some utility functions
	static void exit(){System.out.print(output);System.exit(0);}
	static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;}
	static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;}	
	static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;}	
	static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;}
	static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;}	
	static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;}	
	static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;}
	static long powm(long a, long b, long m){long an=1;long c=a;while(b>0){if(b%2==1)an=(an*c)%m;c=(c*c)%m;b>>=1;}return an;}
	static int gcd(int a, int b){if(b==0)return a;return gcd(b, a%b);}
	static long gcd(long a, long b){if(b==0)return a;return gcd(b, a%b);}
	static class Reader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public Reader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 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();
        }
    }
}