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;
const int maxn=100005;

int n,q;
int S[4*maxn],lazy[4*maxn];

void upd(int id,int l,int r,int ql,int qr,int v) {
    if (ql==l && qr==r) {
        lazy[id]=v;
        return;
    }
    if (lazy[id]!=-1005) {
        S[id]=lazy[id]*(r-l+1);
        if (l!=r) {
            lazy[id<<1]=lazy[id];
            lazy[id<<1|1]=lazy[id];
        }
        lazy[id]=-1005;
    }
    int m=l+r>>1;
    if (qr<=m) upd(id<<1,l,m,ql,qr,v);
    else if (ql>m) upd(id<<1|1,m+1,r,ql,qr,v);
    else upd(id<<1,l,m,ql,m,v),
         upd(id<<1|1,m+1,r,m+1,qr,v);
    S[id]=(lazy[id<<1]!=-1005?lazy[id<<1]*(m-l+1):S[id<<1])+
          (lazy[id<<1|1]!=-1005?lazy[id<<1|1]*(r-m):S[id<<1|1]);
}

int query(int id,int l,int r,int ql,int qr) {
    if (lazy[id]!=-1005) {
        S[id]=lazy[id]*(r-l+1);
        if (l!=r) {
            lazy[id<<1]=lazy[id];
            lazy[id<<1|1]=lazy[id];
        }
        lazy[id]=-1005;
    }
    if (ql==l && qr==r) return S[id];
    int m=l+r>>1;
    if (qr<=m) return query(id<<1,l,m,ql,qr);
    else if (ql>m) return query(id<<1|1,m+1,r,ql,qr);
    else return query(id<<1,l,m,ql,m)+query(id<<1|1,m+1,r,m+1,qr);
}

int main() {
    cin>>n>>q;
    for (int i=0;i<q;i++) {
        int f,s,t,x; cin>>f>>s>>t;
        if (f) cout<<query(1,0,n-1,s,t)<<'\n';
        else {
            cin>>x;
            upd(1,0,n-1,s,t,x);
        }
    }
}
