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>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集
template<typename T>
struct LazySegmentTree{
  const int INF = numeric_limits<int>::max();
  int n0;
  vector<T> node, lazy;

  LazySegmentTree(vector<T> &v){
    int n = v.size();
    n0 = 1;
    while(n0 < n) n0 <<= 1;
    node.resize(2*n0-1);
    lazy.assign(2*n0-1, INF);
    for(int i=0; i<n; i++) node[i+n0-1] = v[i];
    for(int i=n0-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
  }

  void eval(int k, int p){
    if(lazy[k] == INF) return;
    
    if(k < n0-1){
      lazy[k*2+1] = lazy[k];
      lazy[k*2+2] = lazy[k];
    }
    node[k] = lazy[k] * p;
    lazy[k] = INF;
  }

  void update(int a, int b, T x, int k, ll l, ll r){
    eval(k, r-l);
    if(a <= l && r <= b){
      lazy[k] = x;
      eval(k, r-l);
    }else if(a < r && l < b) {
      update(a, b, x, k*2+1, l, (l+r)/2);
      update(a, b, x, k*2+2, (l+r)/2, r);
      node[k] = node[k*2+1] + node[k*2+2];
    }
  }

  void update(int l, int r, T x) { update(l, r, x, 0, 0, n0); }

  T query(int a, int b, int k, ll l, ll r){
    eval(k, r-l);
    if(r <= a || b <= l) return 0;
    else if(a <= l && r <= b){
      return node[k];
    }else{
      T vl = query(a, b, k*2+1, l, (l+r)/2);
      T vr = query(a, b, k*2+2, (l+r)/2, r);
      return vl+vr;
    }
  }
  T query(int l, int r) { return query(l, r, 0, 0, n0); }

  inline T operator[](int a) { return query(a, a + 1); }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(5);
  
  int N, Q; cin >> N >> Q;
  vector<ll> a(N, 0);
  LazySegmentTree<ll> seg(a);

  REP(i,Q){
    int q; cin >> q;
    if(q == 0){
      int s, t, x;
      cin >> s >> t >> x;
      seg.update(s, t+1, x);
    }else{
      int s, t; cin >> s >> t;
      cout << seg.query(s, t+1) << endl;
    }
    // for(int j=0; j<N; j++){
    //   cout << seg[j] << " ";
    // }
    // cout << endl;
  }

  return 0;
}