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 <class T, class U>
struct LazyST {
  int n;
  int stOffset;
  int stHi;
  vector<T> st;
  vector<U> lazy;
  void init(int n) {
    this->n = n;
    stOffset = 1 << (int)ceil(log2(n));
    st.resize(stOffset << 1);
    lazy.resize(st.size());
    stHi = st.size() - 1 - stOffset;
  }
  void updateLazy(const int si, const int lo, const int hi) {
    lazy[si].apply(st[si], lo, hi);
    if (lo != hi) {
      lazy[si << 1] = U(lazy[si << 1], lazy[si]);
      lazy[si << 1 | 1] = U(lazy[si << 1 | 1], lazy[si]);
    }
    lazy[si] = U();
  }
  T query(const int i, const int j, const int si, const int lo, const int hi) {
    updateLazy(si, lo, hi);
    if (i <= lo && hi <= j) return st[si];
    auto mid = (lo + hi) >> 1;
    if (j <= mid) return query(i, j, si << 1, lo, mid);
    if (mid < i) return query(i, j, si << 1 | 1, mid + 1, hi);
    return T(query(i, j, si << 1, lo, mid),
             query(i, j, si << 1 | 1, mid + 1, hi));
  }
  T query(const int i, const int j) {
    return (i <= j && i < n && j >= 0) ? query(i, j, 1, 0, stHi) : T();
  }
  void update(const int i, const int j, const U &u, const int si, const int lo,
              const int hi) {
    if (i <= lo && hi <= j) {
      lazy[si] = U(lazy[si], u);
      updateLazy(si, lo, hi);
    } else {
      updateLazy(si, lo, hi);
      if (hi < i || j < lo) return;
      int mid = (lo + hi) >> 1;
      update(i, j, u, si << 1, lo, mid);
      update(i, j, u, si << 1 | 1, mid + 1, hi);
      st[si] = T(st[si << 1], st[si << 1 | 1]);
    }
  }
  void update(const int i, const int j, const U u) {
    if (i <= j) update(i, j, u, 1, 0, stHi);
  }
};
struct StVal {
  long long v = 0;
  StVal() {}
  StVal(const long long v) : v(v) {}
  StVal(const StVal &v1, const StVal &v2) { v = v1 + v2; }
  operator long long() const { return v; }
};
struct StUpdate {
  long long v = 0;
  StUpdate() {}
  StUpdate(const long long v) : v(v) {}
  StUpdate(const StUpdate &u1, const StUpdate &u2) { v = u1 + u2; }
  operator long long() const { return v; }
  void apply(StVal &v, const int lo, const int hi) {
    v.v += this->v * (hi - lo + 1);
  }
};
struct Range {
  int l, r, x;
  bool operator<(const Range &other) const {
    if (l != other.l) return l < other.l;
    return r < other.r;
  }
};
int n;
set<Range> ranges;
LazyST<StVal, StUpdate> st;
void update(const int l, const int r, const int x) {
  auto it = ranges.lower_bound({l, -1, -1});
  for (; it != ranges.end() && it->r <= r; it = ranges.erase(it))
    st.update(it->l, it->r, abs(x - it->x));
  if (it != ranges.end() && it->l <= r) {
    st.update(it->l, r, abs(x - it->x));
    ranges.insert({r + 1, it->r, it->x});
    it = ranges.erase(it);
  }
  if (it != ranges.begin() && (--it)->r >= l) {
    st.update(l, min(r, it->r), abs(x - it->x));
    ranges.insert({it->l, l - 1, it->x});
    if (it->r > r) ranges.insert({r + 1, it->r, it->x});
    ranges.erase(it);
  }
  ranges.insert({l, r, x});
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> n >> m;
  st.init(n);
  for (int i = 0; i < n; ++i) ranges.insert({i, i, i + 1});
  for (int i = 0; i < m; ++i) {
    int type, l, r;
    cin >> type >> l >> r;
    --l, --r;
    if (type == 1) {
      int x;
      cin >> x;
      update(l, r, x);
    } else {
      assert(type == 2);
      cout << st.query(l, r) << '\n';
    }
  }
  return 0;
}
