DZY loves colors, and he enjoys painting.

On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of the i-th unit of the ribbon is i at first. It is colorful enough, but we still consider that the colorfulness of each unit is 0 at first.

DZY loves painting, we know. He takes up a paintbrush with color x and uses it to draw a line on the ribbon. In such a case some contiguous units are painted. Imagine that the color of unit i currently is y. When it is painted by this paintbrush, the color of the unit becomes x, and the colorfulness of the unit increases by |x - y|.

DZY wants to perform m operations, each operation can be one of the following:

  1. Paint all the units with numbers between l and r (both inclusive) with color x. 
  2. Ask the sum of colorfulness of the units between l and r (both inclusive). 



Can you help DZY?

Input

The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105).

Each of the next m lines begins with a integer type (1 ≤ type ≤ 2), which represents the type of this operation.

If type = 1, there will be 3 more integers l, r, x (1 ≤ l ≤ r ≤ n; 1 ≤ x ≤ 108) in this line, describing an operation 1.

If type = 2, there will be 2 more integers l, r (1 ≤ l ≤ r ≤ n) in this line, describing an operation 2.

Output

For each operation 2, print a line containing the answer — sum of colorfulness.

Examples

Input

3 3
1 1 2 4
1 2 3 5
2 1 3


Output

8


Input

3 4
1 1 3 4
2 1 1
2 2 2
2 3 3


Output

3
2
1


Input

10 6
1 1 5 3
1 2 7 9
1 10 10 11
1 3 8 12
1 1 10 3
2 1 10


Output

129

Note

In the first sample, the color of each unit is initially [1, 2, 3], and the colorfulness is [0, 0, 0].

After the first operation, colors become [4, 4, 3], colorfulness become [3, 2, 0].

After the second operation, colors become [4, 5, 5], colorfulness become [3, 3, 2].

So the answer to the only operation of type 2 is 8.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 3;
struct node {
  long long lazy_sum, sum;
  int lazy_color, color;
  node() { lazy_sum = sum = color = lazy_color = 0; }
};
node tr[MAXN * 4];
void push(int v, int l, int r) {
  tr[v].sum += (r - l + 1) * tr[v].lazy_sum;
  if (l != r)
    tr[v * 2].lazy_sum += tr[v].lazy_sum,
        tr[v * 2 + 1].lazy_sum += tr[v].lazy_sum;
  tr[v].lazy_sum = 0;
  if (tr[v].lazy_color) {
    tr[v].color = tr[v].lazy_color;
    if (l != r)
      tr[v * 2].lazy_color = tr[v * 2 + 1].lazy_color = tr[v].lazy_color;
    tr[v].lazy_color = 0;
  }
}
void merge(int v) { tr[v].sum = tr[v * 2].sum + tr[v * 2 + 1].sum; }
void build(int v, int l, int r) {
  if (l == r) {
    tr[v].color = l;
    return;
  }
  int mid = (l + r) / 2;
  build(v * 2, l, mid);
  build(v * 2 + 1, mid + 1, r);
}
void update_color(int v, int l, int r, int ll, int rr, int color) {
  push(v, l, r);
  if (l > rr || r < ll) return;
  if (l >= ll && r <= rr) {
    tr[v].lazy_color = color;
    return;
  }
  int mid = (l + r) / 2;
  update_color(v * 2, l, mid, ll, rr, color);
  update_color(v * 2 + 1, mid + 1, r, ll, rr, color);
}
int get_color(int v, int l, int r, int pos) {
  push(v, l, r);
  if (l == r) return tr[v].color;
  int mid = (l + r) / 2;
  if (pos <= mid)
    return get_color(v * 2, l, mid, pos);
  else
    return get_color(v * 2 + 1, mid + 1, r, pos);
}
void update_sum(int v, int l, int r, int ll, int rr, int add) {
  push(v, l, r);
  if (l > rr || r < ll) return;
  if (l >= ll && r <= rr) {
    tr[v].lazy_sum += add;
    push(v, l, r);
    return;
  }
  int mid = (l + r) / 2;
  update_sum(v * 2, l, mid, ll, rr, add);
  update_sum(v * 2 + 1, mid + 1, r, ll, rr, add);
  merge(v);
}
long long get_sum(int v, int l, int r, int ll, int rr) {
  push(v, l, r);
  if (l > rr || r < ll) return 0;
  if (l >= ll && r <= rr) return tr[v].sum;
  int mid = (l + r) / 2;
  return get_sum(v * 2, l, mid, ll, rr) +
         get_sum(v * 2 + 1, mid + 1, r, ll, rr);
}
int n, m;
set<int> starts;
void update(int l, int r, int x) {
  vector<int> curr_starts;
  curr_starts.push_back(l);
  for (auto it = starts.upper_bound(l); *it <= r && it != starts.end(); it++)
    curr_starts.push_back(*it);
  curr_starts.push_back(r + 1);
  for (int i = 1; i < curr_starts.size(); i++)
    update_sum(1, 1, n, curr_starts[i - 1], curr_starts[i] - 1,
               abs(x - get_color(1, 1, n, curr_starts[i - 1])));
  update_color(1, 1, n, l, r, x);
  for (auto i : curr_starts)
    if (starts.find(i) != starts.end()) starts.erase(i);
  starts.insert(l);
  starts.insert(r + 1);
}
void read() { cin >> n >> m; }
void solve() {
  build(1, 1, n);
  for (int i = 1; i <= n; i++) starts.insert(i);
  for (int i = 1; i <= m; i++) {
    int type;
    cin >> type;
    if (type == 2) {
      int l, r;
      cin >> l >> r;
      cout << get_sum(1, 1, n, l, r) << endl;
    } else {
      int l, r, x;
      cin >> l >> r >> x;
      update(l, r, x);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  read();
  solve();
}
