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 <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
#define FOR(I,A,B) for(int I=int(A);I<int(B);++I)

// https://onlinejudge.u-aizu.ac.jp/status/users/fullhouse1987/submissions/1/DSL_2_I/judge/4135652/C++14
template <typename T>
class RQ{
public:
	int n,rn,bn,time=0;
	T inicial;
	vector<T> a,b_get,b_update;
	vector<int> atime,btime;//b_get->buket内全てまとめた値
	T updete(T v,T x){return x;}
	T unite(T x,T y){return x+y;}
	T buket_val(T x){return x*rn;}

	RQ(int n_,T ini){
		n = n_; rn =sqrt(n); bn=(n+rn-1)/rn;
		a.resize(n,ini);
		b_get.resize(bn,ini);
		b_update.resize(bn,ini);
		atime.resize(n,-1);
		btime.resize(bn,-1);
		inicial = ini;
	}
	T get(int s,int t){ //[s,t]
		T res = inicial;
		for(int i=s;i<=t;i++){
			if(i%rn==0 && (i+rn-1)<=t){
				res = unite(res,b_get[i/rn]);
				i += rn-1;
			}else{
				if(atime[i]<btime[i/rn]){
					a[i] = updete(a[i],b_update[i/rn]);
					atime[i] = btime[i/rn];
				}
				res = unite(res,a[i]);
			}
		}
		return res;
	}
	void updete(int s,int t,T x){ //[s,t]
		time++;
		for(int i=s;i<=t;i++){
			if(i%rn==0 && (i+rn-1)<=t){
				b_update[i/rn] = updete(b_update[i/rn],x);
				btime[i/rn] = time;
				b_get[i/rn] = buket_val(x);
				i += rn-1;
			}else{
				a[i] = updete(a[i],x);
				atime[i] = time;
				if((i+1)%rn==0 || i==t){
					int bi = i/rn;
					b_get[bi] = inicial;
					for(int j=bi*rn;j<(bi+1)*rn;j++){
						if(atime[j]<btime[bi]){
							a[j] = updete(a[j],b_update[bi]);
							atime[j] = btime[bi];
						}
						b_get[bi] = unite(b_get[bi],a[j]);
					}
				}
			}
		}
	}
};



int main(){ 
	int n,q,s,t,a;
	ll x;
	cin >> n >> q;
	RQ<ll> sg(n+2,0LL);
	FOR(Q,0,q){
		cin >> a;
		if(a){
			cin >> s >> t;
			cout << sg.get(s,t) << endl;
		}else{
			cin >> s >> t >> x;
			sg.updete(s,t,x);
		}
	}
}
