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<bits/stdc++.h>
using namespace std;
using UL=unsigned int;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

struct RSQ_RUQ{
 UL N;
 struct Node{ LL x; LL s; bool z; };
 vector<Node> V;

 void init(UL n){
  N=1; while(N<n) N<<=1;
  V.assign(N*2,Node{0,0,true});
 }

 void upd(UL l,UL r,LL x,UL a=0,UL b=0,UL i=~0u){
  if(i==~0u){ a=0; i=1; b=N; }
  if(r<=a || b<=l) return;
  if(l<=a && b<=r){ V[i]={x,x*(b-a),true}; return; }
  if(V[i].z){
   V[i<<1] = V[(i<<1)+1] = {V[i].x,V[i].s/2,true};
  }
  upd(l,r,x,a,(b+a)>>1,i<<1);
  upd(l,r,x,(b+a)>>1,b,(i<<1)+1);
  V[i]={0,V[i<<1].s+V[(i<<1)+1].s,false};
 }

 LL sum(UL l,UL r,UL a=0,UL b=0,UL i=~0u){
  if(i==~0u){ a=0; i=1; b=N; }
  if(r<=a || b<=l) return 0;
  if(l<=a && b<=r) return V[i].s;
  if(V[i].z) return V[i].x*(min(r,b)-max(l,a));
  LL q1=sum(l,r,a,(b+a)>>1,i<<1);
  LL q2=sum(l,r,(b+a)>>1,b,(i<<1)+1);
  return q1+q2;
 }

} G;

int main(){
 UL N,Q; scanf("%u%u",&N,&Q);
 G.init(N);
 rep(q,Q){
  UL c; scanf("%u",&c);
  if(c==0){
   UL l,r; LL x; scanf("%u%u%lld",&l,&r,&x);
   G.upd(l,r+1,x);
  }
  if(c==1){
   UL l,r; scanf("%u%u",&l,&r);
   printf("%lld\n",G.sum(l,r+1));
  }
 }
 return 0;
}