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 int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % moder;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), moder - 2, moder) % moder * mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


P dat[1000000];
int size_ = 1;
void init(int x) {
	while (size_ < x)size_ *= 2;
	rep(i, 2 * size_ - 1)dat[i] = { 0,inf };
}
void eval(int k, int l, int r) {
	if (dat[k].second != inf) {
		dat[k].first = dat[k].second;
		if (r - l > 1) {
			dat[k * 2 + 1].second = dat[k].second / 2;
			dat[k * 2 + 2].second = dat[k].second / 2;
		}
		dat[k].second = inf;
	}
}
void update(int a, int b, int k, int x, int l, int r) {
	eval(k, l, r);
	if (r <= a || b <= l)return;
	if (a <= l && r <= b) {
		dat[k].second = x * (r - l);
		eval(k, l, r);
	}
	else {
		update(a, b, k * 2 + 1, x, l, (l + r) / 2);
		update(a, b, k * 2 + 2, x, (l + r) / 2, r);
		dat[k].first = dat[k * 2 + 1].first + dat[k * 2 + 2].first;
	}
}
int query(int a, int b, int k, int l, int r) {
	eval(k, l, r);
	if (r <= a || b <= l)return 0;
	if (a <= l && r <= b) {
		return dat[k].first;
	}
	int lv = query(a, b, k * 2 + 1, l, (l + r) / 2);
	int rv = query(a, b, k * 2 + 2, (l + r) / 2, r);
	return lv + rv;
}
signed main() {
	int n, q;
	cin >> n >> q;
	init(n);
	rep(i, q) {
		int a; cin >> a;
		if (!a) {
			int s, t, x; cin >> s >> t >> x;
			update(s, t + 1, 0, x, 0, size_);
		}
		else {
			int s, t; cin >> s >> t;
			cout << query(s, t + 1, 0, 0, size_) << endl;
		}
	}
}