Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int n, q, s, t, x, u, a[1 << 18], i;
iP b[1 << 18];
bool f;

void update(int k, int l, int r) {
	if (!(t < l || r <= s)) {
		if (s <= l&&r - 1 <= t) {
			a[k] = x*(r - l);
			b[k] = mkp(x, i);
		}
		else {
			if (b[k].second > b[k * 2].second) {
				b[k * 2] = b[k];
				a[k * 2] = b[k].first*(r - l) / 2;
			}
			if (b[k].second > b[k * 2 + 1].second) {
				b[k * 2 + 1] = b[k];
				a[k * 2 + 1] = b[k].first*(r - l) / 2;
			}
			update(k * 2, l, (l + r) / 2);
			update(k * 2 + 1, (l + r) / 2, r);
			a[k] = a[k * 2] + a[k * 2 + 1];
		}
	}
}
int getSum(int k,int l,int r){
	if (t < l || r <= s)return 0;
	else if (s <= l&&r - 1 <= t)
		return a[k];
	else {
		if (b[k].second > b[k * 2].second) {
			b[k * 2] = b[k];
			a[k * 2] = b[k].first*(r - l) / 2;
		}
		if (b[k].second > b[k * 2 + 1].second) {
			b[k * 2 + 1] = b[k];
			a[k * 2 + 1] = b[k].first*(r - l) / 2;
		}
		int A = getSum(k * 2, l, (l + r) / 2) + getSum(k * 2 + 1, (l + r) / 2, r);
		a[k] = a[k * 2] + a[k * 2 + 1];
		return A;
	}
}
int main(){
	cin >> n >> q;
	for (u = 1; u < n; u *= 2);
	for (i = 1; i != q + 1; ++i) {
		cin >> f >> s >> t;
		if (f)
			cout << getSum(1, 0, u) << endl;
		else {
			cin >> x;
			update(1, 0, u);
		}
	}
	return 0;
}