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 <stdio.h>
#include <string.h>
const int N=1e5+10;
long long int a[N*4];
int f[N*4];
bool b[N*4];
void add(int n,int x,int l,int r,int L,int R){
    if(L<=l&&r<=R){
        f[n]=x;
        b[n]=true;
        a[n]=(long long int)x*(r-l+1);
    }
    else if(!(L>r||l>R)){
        int mid=(l+r)>>1;
        if(b[n]){
            f[n*2+1]=f[n*2+2]=f[n];
            a[n*2+1]=(long long int)f[n]*(mid-l+1);
            a[n*2+2]=(long long int)f[n]*(r-mid);
            b[n*2+1]=b[n*2+2]=true;
            b[n]=false;
        }
        add(n*2+1,x,l,mid,L,R);
        add(n*2+2,x,mid+1,r,L,R);
        a[n]=a[n*2+1]+a[n*2+2];
    }
    return ;
}
long long int sum(int n,int l,int r,int L,int R){
    if(L<=l&&r<=R)return a[n];
    else if(L>r||l>R)return 0;
    int mid=(l+r)>>1;
    if(b[n]){
        f[n*2+1]=f[n*2+2]=f[n];
        a[n*2+1]=(long long int)f[n]*(mid-l+1);
        a[n*2+2]=(long long int)f[n]*(r-mid);
        b[n*2+1]=b[n*2+2]=true;
        b[n]=false;
    }
    return sum(n*2+1,l,mid,L,R)+sum(n*2+2,mid+1,r,L,R);
}
int main(){
    int n,q,k,l,r;
    memset(a,0,sizeof(a));
    memset(f,0,sizeof(f));
    memset(b,false,sizeof(b));
    scanf("%d%d",&n,&q);
    n--;
    while(q--){
        scanf("%d",&k);
        if(k==0){
            scanf("%d%d%d",&l,&r,&k);
            add(0,k,0,n,l,r);
        }
        else {
            scanf("%d%d",&l,&r);
            printf("%lld\n",sum(0,0,n,l,r));
        }
    }
}
