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;
template <typename T, typename U>
bool ckmin(T &a, U b) {
  return b < a ? a = b, true : false;
}
template <typename T, typename U>
bool ckmax(T &a, U b) {
  return b > a ? a = b, true : false;
}
template <typename T, typename S>
struct LazySegmentTree {
  int SZ;
  T id;
  vector<T> t;
  vector<S> lazy;
  LazySegmentTree(T x, int sz)
      : id(x), SZ(sz), lazy((SZ << 2) + 5), t((SZ << 2) + 5) {}
  LazySegmentTree(vector<T> &a, T x, int sz)
      : id(x), SZ(sz), lazy((SZ << 2) + 5), t((SZ << 2) + 5) {
    build(1, 0, SZ - 1, a);
  }
  void push(int v, int tl, int tr) {
    if (lazy[v]) {
      int tm = tl + (tr - tl) / 2;
      if ((v << 1) < (SZ << 2) + 5) {
        lazy[v << 1] += lazy[v];
        t[v << 1] += lazy[v] * (tm - tl + 1);
      }
      if (((v << 1) | 1) < (SZ << 2) + 5) {
        lazy[(v << 1) | 1] += lazy[v];
        t[(v << 1) | 1] += lazy[v] * (tr - tm);
      }
    }
    lazy[v] = 0;
  }
  T cmb(T x, T y) { return x + y; }
  void build(int v, int tl, int tr, vector<T> &a) {
    if (tl == tr)
      t[v] = a[tl];
    else {
      int tm = tl + (tr - tl) / 2;
      build(v << 1, tl, tm, a);
      build((v << 1) | 1, tm + 1, tr, a);
      t[v] = cmb(t[v << 1], t[(v << 1) | 1]);
    }
  }
  T qry(int l, int r) { return qry(1, 0, SZ - 1, l, r); };
  T qry(int v, int tl, int tr, int l, int r) {
    push(v, tl, tr);
    if (l > r) return id;
    int tm = tl + (tr - tl) / 2;
    if (tl == l && tr == r) return t[v];
    return cmb(qry(v << 1, tl, tm, l, min(r, tm)),
               qry((v << 1) | 1, tm + 1, tr, max(l, tm + 1), r));
  }
  void upd(int l, int r, T x) { upd(1, 0, SZ - 1, l, r, x); };
  void upd(int v, int tl, int tr, int l, int r, T x) {
    push(v, tl, tr);
    if (l > r) return;
    int tm = tl + (tr - tl) / 2;
    if (tl == l && tr == r) {
      lazy[v] = x;
      t[v] += x * (r - l + 1);
    } else {
      upd(v << 1, tl, tm, l, min(r, tm), x);
      upd((v << 1) | 1, tm + 1, tr, max(l, tm + 1), r, x);
      t[v] = cmb(t[v << 1], t[(v << 1) | 1]);
    }
  }
  void print() {
    for (int i = 0; i < SZ; ++i) {
      cout << qry(i, i) << " ";
    }
    cout << "\n";
  }
};
const long long INF = 2e18;
long long n, m;
set<pair<pair<long long, long long>, long long>,
    greater<pair<pair<long long, long long>, long long>>>
    rseg;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    rseg.insert({{i, i}, i + 1});
  }
  LazySegmentTree<long long, long long> st(0LL, n);
  while (m--) {
    long long ver, l, r, x;
    cin >> ver >> l >> r;
    ver--, l--, r--;
    if (ver)
      cout << st.qry(l, r) << "\n";
    else {
      cin >> x;
      vector<pair<pair<long long, long long>, long long>> a;
      auto it = rseg.lower_bound({{l, INF}, INF});
      assert(it != rseg.end());
      while (it->first.first <= r) {
        a.push_back(*it);
        if (it != rseg.begin())
          --it;
        else
          break;
      }
      for (auto i : a) {
        rseg.erase(i);
      }
      if (a[0].first.first < l)
        rseg.insert({{a[0].first.first, l - 1}, a[0].second});
      st.upd(l, min(a[0].first.second, r), abs(x - a[0].second));
      if ((int)(a).size() > 1) {
        if (a.back().first.second > r)
          rseg.insert({{r + 1, a.back().first.second}, a.back().second});
        st.upd(a.back().first.first, r, abs(x - a.back().second));
      } else if (a.back().first.second > r)
        rseg.insert({{r + 1, a.back().first.second}, a.back().second});
      rseg.insert({{l, r}, x});
      for (int i = 1; i < (int)(a).size() - 1; ++i) {
        st.upd(a[i].first.first, a[i].first.second, abs(x - a[i].second));
      }
    }
  }
  return 0;
}
