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
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const ld eps = 1e-9;
const db PI = atan(1) * 4;

template<typename T, typename S>inline bool upmin(T&a, const S&b) { return a > b ? a = b, 1 : 0; }
template<typename T, typename S>inline bool upmax(T&a, const S&b) { return a < b ? a = b, 1 : 0; }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }
ll pow(ll a, ll b) {
	if (b == 0) {
		return 1;
	}
	if (b == 1) {
		return a;
	}
	ll ans = pow(a, b / 2);
	ans *= ans;
	ans *= b % 2 == 1 ? a : 1;
	return ans;
}

namespace SOLVE {
	VI A;

	struct SegTree {
		static const int maxn = 100000;

		struct node {
			ll l, r, value, lazy;
		};

		ll amount(node n) {
			return n.r - n.l + 1;
		}

		node no[maxn * 4];
		void push_up(int ind) {
			no[ind].value = (no[lson].value + no[rson].value);
		}
		void push_down(int ind) {
			if (no[ind].lazy == 1) {
				ll one = no[ind].value / amount(no[ind]);
				no[lson].value = one * amount(no[lson]);
				no[rson].value = one * amount(no[rson]);
				no[lson].lazy = 1;
				no[rson].lazy = 1;
				no[ind].lazy = 0;
			}
		}

		void build(int l, int r, int ind) {
			no[ind].l = l;
			no[ind].r = r;
			no[ind].value = 0;
			no[ind].lazy = 0;
			if (l == r) {
				no[l].value = 0;
				no[l].lazy = 0;
			}
			else {
				int mid = (l + r) / 2;
				build(l, mid, lson);
				build(mid + 1, r, rson);
				push_up(ind);
			}
		}

		void update(int l, int r, int ind, ll val) {
			if (l > no[ind].r || r < no[ind].l)return;
			if (l <= no[ind].l && no[ind].r <= r) {
				no[ind].value = val * amount(no[ind]);
				no[ind].lazy = 1;
			}
			else {
				push_down(ind);
				update(l, r, lson, val);
				update(l, r, rson, val);
				push_up(ind);
			}
		}
		void query(int l, int r, int ind, ll& ans) {
			if (l > no[ind].r || r < no[ind].l) {
				ans = 0;
				return;
			}
			if (l <= no[ind].l && no[ind].r <= r) {
				ans = no[ind].value;
				return;
			}
			else {
				ll ans1, ans2;
				push_down(ind);
				query(l, r, lson, ans1);
				query(l, r, rson, ans2);
				ans = ans1 + ans2;
				push_up(ind);
				return;
			}
		}
		void show(int x) {
			REP(i, 1, x) {
				cout << no[i].value << ' ';
			}
			cout << endl;
		}
	};






	SegTree tree;

	void main() {
		ll n, q, a, b, c, d, ans;
		cin >> n >> q;

		A.resize(n, pow(2,31)-1);

		tree.build(0, n-1, 1);
	
		REP(i, 0, q) {
			cin >> a;
			if (a == 0) {
				cin >> b >> c >> d;
				tree.update(b, c, 1, d);
				
			}
			else {
				
				cin >> b >> c;
				tree.query(b, c, 1, ans);
				cout << ans << endl;
			}
		}
	}
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	//    in(t);
	t = 1;
	while (t--) {
		SOLVE::main();

	}

	return 0;
}

