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 N = 100000;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const long double pi = atan2(0, -1);
const long double eps = 1e-6;
const int ABC = 26;
struct node {
  int pr;
  int len, sz, col;
  node *L, *R;
  node() { L = R = NULL; }
  node(int len, int col) {
    pr = rand() << 15 | rand();
    this->sz = this->len = len;
    this->col = col;
    L = R = NULL;
  }
};
int get_sz(node *t) {
  if (t == NULL)
    return 0;
  else
    return t->sz;
}
void upd(node *t) {
  if (t == NULL) return;
  t->sz = get_sz(t->L) + t->len + get_sz(t->R);
}
pair<node *, node *> split(node *t, int cnt) {
  if (t == NULL)
    return {NULL, NULL};
  else if (get_sz(t->L) >= cnt) {
    auto p = split(t->L, cnt);
    t->L = p.second;
    upd(t);
    p.second = t;
    return p;
  } else if (get_sz(t->L) + t->len <= cnt) {
    auto p = split(t->R, cnt - (get_sz(t->L) + t->len));
    t->R = p.first;
    upd(t);
    p.first = t;
    return p;
  } else {
    node *t1 = new node(t->len - (cnt - get_sz(t->L)), t->col);
    t1->R = t->R;
    t->R = NULL;
    t->len -= t1->len;
    upd(t);
    upd(t1);
    return {t, t1};
  }
}
node *merge(node *l, node *r) {
  if (l == NULL)
    return r;
  else if (r == NULL)
    return l;
  else if (l->pr <= r->pr) {
    l->R = merge(l->R, r);
    upd(l);
    return l;
  } else {
    r->L = merge(l, r->L);
    upd(r);
    return r;
  }
}
vector<pair<int, int> > elems;
void get_elems(node *t) {
  if (t == NULL) return;
  get_elems(t->L);
  elems.push_back({t->len, t->col});
  get_elems(t->R);
}
int cnt_v = 1;
long long tree[N * 4], add[N * 4];
void build(int n) {
  while (cnt_v < n) cnt_v <<= 1;
}
void push(int x, int lx, int rx) {
  int m = (lx + rx) / 2;
  tree[x * 2 + 1] += add[x] * (m - lx);
  add[x * 2 + 1] += add[x];
  tree[x * 2 + 2] += add[x] * (rx - m);
  add[x * 2 + 2] += add[x];
  add[x] = 0;
}
void upd(int x, int lx, int rx, int l, int r, long long v) {
  if (lx >= r || l >= rx)
    return;
  else if (lx >= l && rx <= r) {
    tree[x] += v * (rx - lx);
    add[x] += v;
  } else {
    push(x, lx, rx);
    upd(x * 2 + 1, lx, (lx + rx) / 2, l, r, v);
    upd(x * 2 + 2, (lx + rx) / 2, rx, l, r, v);
    tree[x] = tree[x * 2 + 1] + tree[x * 2 + 2];
  }
}
long long get(int x, int lx, int rx, int l, int r) {
  if (lx >= r || l >= rx)
    return 0;
  else if (lx >= l && rx <= r)
    return tree[x];
  else {
    push(x, lx, rx);
    return get(x * 2 + 1, lx, (lx + rx) / 2, l, r) +
           get(x * 2 + 2, (lx + rx) / 2, rx, l, r);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  int n, m;
  cin >> n >> m;
  build(n);
  node *DD = NULL;
  for (int i = 0; i < n; i++) DD = merge(DD, new node(1, i + 1));
  for (int i = 0; i < m; i++) {
    int type;
    cin >> type;
    if (type == 1) {
      int l, r, x;
      cin >> l >> r >> x;
      l--;
      r--;
      auto p = split(DD, l);
      auto p1 = split(p.second, (r - l + 1));
      elems.clear();
      get_elems(p1.first);
      int pos = l;
      for (auto it : elems) {
        upd(0, 0, cnt_v, pos, pos + it.first, abs(x - it.second));
        pos += it.first;
      }
      DD = merge(merge(p.first, new node((r - l + 1), x)), p1.second);
    } else {
      int l, r;
      cin >> l >> r;
      l--;
      r--;
      cout << get(0, 0, cnt_v, l, r + 1) << "\n";
    }
  }
  return 0;
}
