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<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<math.h>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N (1<<17)
#define G 2147483647
class RUQ{
private:
    #define D 17
    ll dat[2*N],laz[2*N];
    ll eval(int k){
	if(laz[k]!=G){
	    dat[k]=laz[k]*(1<<(D-(ll)log2(k)));
	    if(k<N){
		laz[k*2]=laz[k];
		laz[k*2+1]=laz[k];
	    }
	}
	laz[k]=G;
	return dat[k];
    }
public:
    void Init(){
	lol(i,2*N)dat[i]=0,laz[i]=G;
    }
    void Upd(int l,int r,ll x){
	l+=N,r+=N+1;
	for(int i=D;i>=0;i--){
	    eval(l>>i);eval(r>>i);
	}
	for(int a=l,b=r;a<b;a>>=1,b>>=1){
	    if(a&1)laz[a++]=x;
	    if(b&1)laz[--b]=x;
	}
	for(int a=l,b=r;a;a>>=1,b>>=1){
	    dat[a/2]=eval(a)+eval(a^1);
	    dat[b/2]=eval(b)+eval(b^1);
	}
    }
    ll Sum(int l,int r){
	l+=N,r+=N+1;
	for(int i=D;i>=0;i--){
	    eval(l>>i);eval(r>>i);
	}
	ll res=0;
	for(int a=l,b=r;a<b;a>>=1,b>>=1){
	    if(a&1)res+=eval(a++);
	    if(b&1)res+=eval(--b);
	}
	return res;
    }
};
int main(){
    int n,q;cin>>n>>q;
    RUQ seg;seg.Init();
    while(q--){
	ll a,b,c;cin>>a;
	if(a==0){
	    cin>>a>>b>>c;
	    seg.Upd(a,b,c);
	}
	else{
	    cin>>a>>b;
	    cout<<seg.Sum(a,b)<<endl;
	}
    }
    return 0;
}