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.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;


public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int N = ni();
		int m = ni();
		long[] arr = new long[N];
		for (int i = 0; i < N; i++)
			arr[i] = i + 1;
		SQRT sqrt = new SQRT(arr);
		
		for(int i =0;i<m;i++){
			String[] line = in.readLine().split(" ");
			if(Integer.parseInt(line[0]) == 1){
				sqrt.pintar(Integer.parseInt(line[1]) - 1, Integer.parseInt(line[2]),Integer.parseInt(line[3]));
			}else{
				out.println(sqrt.query(Integer.parseInt(line[1]) - 1, Integer.parseInt(line[2])));
			}
		}
		
		return null;
	}

	static class SQRT {
		int N;
		int M;
		Block[] bs;
		int SIZE_BLOCK;

		long[] arr;
		long[] colorful;
		
		
		SQRT(long[] arr) {
			this.N = arr.length;
			this.SIZE_BLOCK = (int) (Math.sqrt(N)); // cambiar, si quiero
			this.M = (N + SIZE_BLOCK -1)/SIZE_BLOCK;
			
			this.arr = arr;
			this.colorful = new long[N];
			
			bs = new Block[M];
			for (int i = 0; i < M; i++) {
				int lo = SIZE_BLOCK * i;
				int hi = Math.min(SIZE_BLOCK * (i + 1), N);

				bs[i] = new Block(lo, hi);
			}
		}

		void pintar(int lo, int hi, int color) {
			int index_lo = lo / SIZE_BLOCK;
			int index_hi = (hi - 1) / SIZE_BLOCK;

			if (index_lo == index_hi) {
				bs[index_lo].update(lo, hi, color);
				return;
			}
			bs[index_lo].update(lo, (index_lo + 1) * SIZE_BLOCK, color);
			bs[index_hi].update(index_hi * SIZE_BLOCK, Math.min(hi, (index_hi + 1) * SIZE_BLOCK), color);

			for (int i = index_lo + 1; i <= index_hi - 1; i++) {
				bs[i].update(i * SIZE_BLOCK, (i + 1) * SIZE_BLOCK, color);
			}
		}
		
		long query(int lo, int hi){
			int index_lo = lo / SIZE_BLOCK;
			int index_hi = (hi - 1) / SIZE_BLOCK;
			if (index_lo == index_hi) {
				return bs[index_lo].sum(lo, hi);
			}
			
			long ret = bs[index_lo].sum(lo, (index_lo + 1) * SIZE_BLOCK);
			ret += bs[index_hi].sum(index_hi * SIZE_BLOCK, Math.min(hi, (index_hi + 1) * SIZE_BLOCK));

			for (int i = index_lo + 1; i <= index_hi - 1; i++) {
				ret+=bs[i].val;
			}
			return ret;
			
		}

		class Block {
			int lo; // inc
			int hi; // exc

			long color;
			long diff;

			long val;

			Block(int lo, int hi) {
				this.lo = lo;
				this.hi = hi;

				this.val = 0;

				this.color = -1;
				this.diff = 0;
			}

			public long sum(int lo, int hi) {
				long ret =0;
				for(int i =lo;i<hi;i++)
					ret+= colorful[i] + diff;
				return ret;
			}

			void update(int start, int end, int new_color) {

				// completo a completo
				if (this.color != -1 && lo == start && hi == end) {
					diff += Math.abs(color - new_color);
					val += Math.abs(color - new_color) * (hi - lo);
					color = new_color;
					return;
				}

				// incompleto a completo
				if (this.color == -1 && lo == start && hi == end) {
					for (int i = lo; i < hi; i++) {
						long add = Math.abs(arr[i] - new_color);
						colorful[i] += add;
						val += add;
						arr[i] = new_color;
					}
					diff = 0;
					color = new_color;
					return;
				}

				// completo a incompleto
				if (this.color != -1) {
					for (int i = lo; i < hi; i++) {
						colorful[i] += diff;
						arr[i] = color;
					}
					diff = 0;
					color = -1;
					// sigo
				}
				
				// _ a incompleto
				for (int i = start; i < end; i++) {
					long add = Math.abs(arr[i] - new_color);
					colorful[i] += add;
					val += add;
					arr[i] = new_color;
				}

			}

		}
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}