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 <cstdio>
#include <algorithm>

using namespace std;


const int MAXN=1e5+10;
using ll=long long int;

struct Node{
    int lbound,rbound;
    bool updated;
    ll diff;
    ll sum;
    Node *left,*right;
};

Node segtree[MAXN*2];
Node* next_pos=segtree;
int n,q;

Node* build(int left,int right){
    auto* cur=next_pos;
    next_pos++;
    cur->lbound=left;
    cur->rbound=right;

    cur->updated=false;
    cur->diff=0;
    

    int mid=(left+right)/2;

    //リーフノードのケース
    if (right-left==1) {
        cur->sum=0;
        return cur;
    }

    cur->left=build(left,mid);
    cur->right=build(mid,right);
    //総和を集計
    cur->sum=0;
    return cur;
}

//シングルノードの更新
void update(Node& self,ll d){
    self.diff=d;
    self.sum=d*(self.rbound-self.lbound);
    self.updated=true;
}

void update(Node& self,int l,int r,int u){
    int mid=(self.lbound+self.rbound)/2;
    
    if (self.rbound-self.lbound!=1&&self.updated){
        update(*self.left,self.diff);
        update(*self.right,self.diff);
        self.diff=0;
        self.updated=false;
    }

    if (l==self.lbound&&r==self.rbound){
        update(self,u);
    }else if (l>=mid){
        update(*self.right,l,r,u);
        self.sum=self.left->sum+self.right->sum;
    }else if (r<=mid){
        update(*self.left,l,r,u);
        self.sum=self.left->sum+self.right->sum;
    }else{
        update(*self.left,l,mid,u);
        update(*self.right,mid,r,u);
        self.sum=self.left->sum+self.right->sum;
    }
}

//シングルポイント
int query(Node& self,int i){
    // puts("q");
    if (self.rbound-self.lbound==1&&self.lbound==i) return self.diff;
    int mid=(self.lbound+self.rbound)/2;
    if (i>=mid) return query(*self.right,i)+self.diff;
    else return query(*self.left,i)+self.diff;
}

//区間
ll query(Node& self,int l,int r){
    int mid=(self.lbound+self.rbound)/2;

    //更新があるノードの区間をプッシュボタン
    if (self.rbound-self.lbound!=1&&self.updated){
        update(*self.left,self.diff);
        update(*self.right,self.diff);
        self.diff=0;
        self.updated=false;
    }

    if (l==self.lbound&&r==self.rbound){
        return self.sum;
    }else if (l>=mid){
        return query(*self.right,l,r);
    }else if (r<=mid){
        return query(*self.left,l,r);
    }else{
        return query(*self.left,l,mid)+query(*self.right,mid,r);
    }
}

int main(){
    scanf("%d%d",&n,&q);
    build(0,n);
    // printf("%lld\n",segtree[0].sum);
    for(int i=0;i<q;i++){
        int t;
        scanf("%d",&t);
        if (t==0){
            int s,t,x;
            scanf("%d%d%d",&s,&t,&x);
            update(segtree[0],s,t+1,x);
        }else{
            int l,r;
            scanf("%d%d",&l,&r);
            printf("%lld\n",query(segtree[0],l,r+1));
        }

    }
    return 0;
}
