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 <bits/stdc++.h>

class SegmentTree {
private:
	std::vector<int64_t> sumContainer_, updateContainer_;
	int tree_width_;

	void lazyEvaluate(const int node_i)
	{
		if (updateContainer_[node_i] == LLONG_MAX) return;
		sumContainer_[node_i] = updateContainer_[node_i];
		if (node_i < tree_width_)
		{
			updateContainer_[2 * node_i] = updateContainer_[node_i] >> 1;
			updateContainer_[2 * node_i + 1] = updateContainer_[node_i] >> 1;
		}
		updateContainer_[node_i] = LLONG_MAX;
	}

	void updateImplement(const int query_l, const int query_r, const int node_l, const int node_r, const int node_i, const int64_t assigned)
	{
		if (query_l <= node_l && node_r <= query_r)
		{
			updateContainer_[node_i] = assigned;
			lazyEvaluate(node_i);
			return;
		}
		lazyEvaluate(node_i);
		if (node_r <= query_l || query_r <= node_l) return;
		const int node_m{(node_l + node_r) >> 1};
		updateImplement(query_l, query_r, node_l, node_m, 2 * node_i, assigned >> 1);
		updateImplement(query_l, query_r, node_m, node_r, 2 * node_i + 1, assigned >> 1);
		sumContainer_[node_i] = sumContainer_[2 * node_i] + sumContainer_[2 * node_i + 1];
	}

	int64_t findImplement(const int query_l, const int query_r, const int node_l, const int node_r, const int node_i)
	{
		if (node_r <= query_l || query_r <= node_l) return 0ll;
		lazyEvaluate(node_i);
		if (query_l <= node_l && node_r <= query_r) return sumContainer_[node_i];
		const int node_m{(node_l + node_r) >> 1};
		return findImplement(query_l, query_r, node_l, node_m, 2 * node_i) + findImplement(query_l, query_r, node_m, node_r, 2 * node_i + 1);
	}
public:
	SegmentTree(const int n)
	{
		int size{1};
		while (size < n) size <<= 1;
		tree_width_ = size;
		sumContainer_.resize(2 * size);
		updateContainer_.resize(2 * size);
	}

	void update(const int left, const int right, int64_t assigned)
	{
		updateImplement(left, right, 0, tree_width_, 1, assigned * tree_width_);
	}

	int64_t find(const int left, const int right)
	{
		return findImplement(left, right, 0, tree_width_, 1);
	}
};

int main()
{
	int n, q;
	scanf("%d%d", &n, &q);
	SegmentTree st(n);
	for (int q_i{}; q_i < q; q_i++)
	{
		int query, s, t;
		scanf("%d%d%d", &query, &s, &t);
		t++;
		if (query == 0)
		{
			int x;
			scanf("%d", &x);
			st.update(s, t, x);
		}
		else
			printf("%lld\n", st.find(s, t));
	}
	return 0;
}
