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 inf = (1 << 30);
const long long infll = (1LL << 60);
const int MAXN = 100010;
long long st[4 * MAXN], lazy[4 * MAXN];
inline void fix(int index, int l, int r) {
  st[index] += lazy[index] * (r - l + 1);
  if (l != r) {
    lazy[(index << 1)] += lazy[index];
    lazy[((index << 1) + 1)] += lazy[index];
  }
  lazy[index] = 0;
}
void update(int index, int l, int r, int ql, int qr, long long v) {
  fix(index, l, r);
  if (l > qr || r < ql) return;
  if (l >= ql && r <= qr) {
    lazy[index] += v;
    fix(index, l, r);
  } else {
    update((index << 1), l, ((l + r) / 2), ql, qr, v);
    update(((index << 1) + 1), ((l + r) / 2) + 1, r, ql, qr, v);
    st[index] = st[(index << 1)] + st[((index << 1) + 1)];
  }
}
long long query(int index, int l, int r, int ql, int qr) {
  fix(index, l, r);
  if (l > qr || r < ql) return 0;
  if (l >= ql && r <= qr) return st[index];
  long long a = query((index << 1), l, ((l + r) / 2), ql, qr);
  long long b = query(((index << 1) + 1), ((l + r) / 2) + 1, r, ql, qr);
  return a + b;
}
struct seg {
  int v;
  int l, r;
  seg() {}
  seg(int a, int b, int c) {
    v = a;
    l = b;
    r = c;
  }
};
int n, q;
map<int, pair<int, long long>> cur;
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) cur[i] = make_pair(i, i + 1);
  while (q--) {
    int t, l, r;
    scanf("%d%d%d", &t, &l, &r);
    l--, r--;
    if (t == 1) {
      int v;
      scanf("%d", &v);
      vector<seg> vv;
      auto it = cur.upper_bound(l);
      it--;
      while (it != cur.end()) {
        if (it->first > r || it->second.first < l)
          break;
        else {
          int cl = max(it->first, l);
          int cr = min(it->second.first, r);
          if (l > it->first)
            vv.push_back(seg(it->second.second, it->first, cl - 1));
          if (r < it->second.first)
            vv.push_back(seg(it->second.second, cr + 1, it->second.first));
          int d = abs(v - it->second.second);
          update(1, 0, n - 1, cl, cr, d);
          cur.erase(it++);
        }
      }
      for (int i = 0; i < vv.size(); i++)
        cur[vv[i].l] = make_pair(vv[i].r, vv[i].v);
      cur[l] = make_pair(r, v);
    } else {
      printf("%I64d\n", query(1, 0, n - 1, l, r));
    }
  }
}
