Write a program which manipulates a sequence $A$ = {$a_0, a_1, ..., a_{n-1}$} with the following operations:

* $update(s, t, x)$: change $a_s, a_{s+1}, ..., a_t$ to $x$.
* $getSum(s, t)$: print the sum of $a_s, a_{s+1}, ..., a_t$.



Note that the initial values of $a_i ( i = 0, 1, ..., n-1 )$ are 0.

Constraints

* $1 ≤ n ≤ 100000$
* $1 ≤ q ≤ 100000$
* $0 ≤ s ≤ t < n$
* $-1000 ≤ x ≤ 1000$

Input


$n$ $q$
$query_1$
$query_2$
:
$query_q$


In the first line, $n$ (the number of elements in $A$) and $q$ (the number of queries) are given. Then, $i$-th query $query_i$ is given in the following format:


0 $s$ $t$ $x$


or


1 $s$ $t$


The first digit represents the type of the query. '0' denotes $update(s, t, x)$ and '1' denotes $find(s, t)$.

Output

For each $getSum$ query, print the sum in a line.

Example

Input

6 7
0 1 3 1
0 2 4 -2
1 0 5
1 0 1
0 3 5 3
1 3 4
1 0 5


Output

-5
1
6
8
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define f(i,n) for(int i=0;i<int(n);i++)
#define N (1<<18)
#define INIT 9223372036854775807
#define INIT2 0
#define INIT3 0
long long a[(2 * N)];
long long laz[(2 * N)];
int l[(2 * N)];
int r[(2 * N)];

long long f1(long long x, long long y) {
	if (x != INIT)return x;
	return y;
}
long long f2(long long k, long long x, long long y) {
	if (x != INIT)return x*(r[k]-l[k]);
	return y;
}
long long f3(long long x, long long y) {
	return (x + y);
}


void init(void) {
	f(i, (2 * N)) {
		a[i] = INIT2;
		laz[i] = INIT;
	}
	l[1] = 0;
	r[1] = N;
	for (int i = 1; i < N; i++) {
		l[(2 * i)] = l[i];
		r[(2 * i)] = (l[i] + r[i]) / 2;
		l[(2 * i) + 1] = (l[i] + r[i]) / 2;
		r[(2 * i) + 1] = r[i];
	}
	return;
}



long long change(int ll, int rr, int k, long long x) {
	long long vl, vr;
	if ((rr <= l[k]) || (r[k] <= ll))return f2(k, laz[k], a[k]);
	if (laz[k] != INIT) {
		a[k] = f2(k, laz[k], a[k]);
		if (k < N) {
			laz[(2 * k)] = f1(laz[k], laz[(2 * k)]);
			laz[(2 * k) + 1] = f1(laz[k], laz[(2 * k) + 1]);
		}
		laz[k] = INIT;
	}
	if ((ll <= l[k]) && (r[k] <= rr)) {
		laz[k] = f1(x, laz[k]);
		return f2(k, laz[k], a[k]);
	}
	else {
		int mm = (l[k] + r[k]) / 2;
		if ((l[k] < rr) && (ll < mm)) {
			vl = change(ll, rr, 2 * k, x);
		}
		else vl = f2((2 * k), laz[(2 * k)], a[(2 * k)]);

		if ((mm < rr) && (ll < r[k])) {
			vr = change(ll, rr, (2 * k) + 1, x);
		}
		else vr = f2((2 * k) + 1, laz[(2 * k) + 1], a[(2 * k + 1)]);

		a[k] = f3(vl, vr);
		return f2(k, laz[k], a[k]);
	}
}


long long search(int ll, int rr, int k) {
	if (laz[k] != INIT) {
		a[k] = f2(k, laz[k], a[k]);
		if (k < N) {
			laz[(2 * k)] = f1(laz[k], laz[(2 * k)]);
			laz[(2 * k) + 1] = f1(laz[k], laz[(2 * k) + 1]);
		}
		laz[k] = INIT;
	}
	long long vl, vr;
	if (rr <= l[k] || r[k] <= ll)return INIT3;
	else if (ll <= l[k] && r[k] <= rr) return f2(k, laz[k], a[k]);
	else {
		vl = search(ll, rr, 2 * k);
		vr = search(ll, rr, (2 * k) + 1);
		a[k] = f3(f2((2 * k), laz[(2 * k)], a[(2 * k)]), f2((2 * k) + 1, laz[(2 * k) + 1], a[(2 * k) + 1]));
		return f3(vl, vr);
	}
}


int main(void) {
	int q;
	int c, x, y;
	long long k;
	init();
	scanf("%d %d", &c, &q);
	f(qq, q) {
		scanf("%d", &c);
		if (c == 0) {
			scanf("%d %d %lld", &x, &y, &k);
			change(x, y + 1, 1, k);
		}
		else if (c == 1) {
			scanf("%d %d", &x, &y);
			k = search(x, y + 1, 1);
			printf("%lld\n", k);
		}
	}
	return 0;
}
