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;
int break_point() {
  char c;
  while ((c = getchar()) != '\n')
    ;
  return 0;
}
template <typename T>
void read_integer(T &r) {
  bool sign = 0;
  r = 0;
  char c;
  while (1) {
    c = getchar();
    if (c == '-') {
      sign = 1;
      break;
    }
    if (c != ' ' && c != '\n') {
      r = c - '0';
      break;
    }
  }
  while (1) {
    c = getchar();
    if (c == ' ' || c == '\n') break;
    r = r * 10 + (c - '0');
  }
  if (sign) r = -r;
}
long long binpowmod(long long a, long long b, long long mod) {
  if (b == 0) return 1;
  long long c = binpowmod(a, b >> 1, mod);
  return (((c * c) % mod) * (b & 1 ? a : 1)) % mod;
}
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long c = binpow(a, b >> 1);
  return c * c * (b & 1 ? a : 1);
}
inline int getbit(int x, int b) { return (x >> b) & 1; }
inline long long getbit(long long x, int b) { return (x >> b) & 1; }
inline unsigned long long getbit(unsigned long long x, int b) {
  return (x >> b) & 1;
}
inline int setbit(int x, int b) { return x | (1 << b); }
inline void _setbit(int &x, int b) { x = setbit(x, b); }
inline long long setbit(long long x, int b) { return x | (1ll << b); }
inline void _setbit(long long &x, int b) { x = setbit(x, b); }
inline int unsetbit(int x, int b) { return x & (INT_MAX - (1 << b)); }
inline void _unsetbit(int &x, int b) { x = unsetbit(x, b); }
inline int countbit(int x) {
  x = x - ((x >> 1) & 0x55555555);
  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
  return ((x + (x >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
inline long long countbit(long long x) {
  int p1 = (x >> 32) & ((1ll << 32) - 1);
  int p2 = x & ((1ll << 32) - 1);
  return countbit(p1) + countbit(p2);
}
template <typename T>
void printbit(T x, int len) {
  for (int i = len - 1; i >= 0; i--) printf("%d", getbit(x, i));
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
template <typename A, typename B>
ostream &operator<<(ostream &stream, const pair<A, B> &p) {
  stream << "{" << p.first << "," << p.second << "}";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const vector<A> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A, typename B>
ostream &operator<<(ostream &stream, const map<A, B> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const set<A> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const stack<A> &v) {
  stack<A> st;
  stream << "[";
  while (!st.empty()) {
    stream << st.top() << " ";
    st.pop();
  }
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const priority_queue<A> &v) {
  priority_queue<A> q = v;
  stream << "[";
  while (!q.empty()) {
    stream << q.top() << " ";
    q.pop();
  }
  stream << "]";
  return stream;
}
void run();
int main() {
  srand(time(NULL));
  do {
    run();
    if (0) {
      0 ? printf("-------------------------------\n") : 0;
      0 ? printf("-------------------------------\n") : 0;
    }
  } while (0);
  return 0;
}
struct SegmentTree {
  vector<long long> tr;
  vector<long long> psh;
  int n;
  SegmentTree(int cnt) : n(cnt) {
    tr.resize(4 * n);
    psh.resize(4 * n);
  }
  void push(int v, int l, int r) {
    if (l == r) {
      psh[v] = 0;
      return;
    } else {
      int mid = (l + r) >> 1;
      tr[v + v] += 1ll * (mid - l + 1) * psh[v];
      psh[v + v] += psh[v];
      tr[v + v + 1] += 1ll * (r - mid) * psh[v];
      psh[v + v + 1] += psh[v];
    }
    psh[v] = 0;
  }
  void add_impl(int v, int l, int r, int L, int R, int val) {
    if (R < L) return;
    if (l == L && r == R) {
      tr[v] += 1ll * (r - l + 1) * val;
      psh[v] += val;
    } else {
      push(v, l, r);
      int mid = (l + r) >> 1;
      add_impl(v + v, l, mid, L, min(R, mid), val);
      add_impl(v + v + 1, mid + 1, r, max(mid + 1, L), R, val);
      tr[v] = tr[v + v] + tr[v + v + 1];
    }
  }
  void add(int l, int r, int val) { add_impl(1, 0, n - 1, l, r, val); }
  long long get_sum_impl(int v, int l, int r, int L, int R) {
    if (R < L) return 0;
    if (l == L && r == R)
      return tr[v];
    else {
      push(v, l, r);
      int mid = (l + r) >> 1;
      return get_sum_impl(v + v, l, mid, L, min(R, mid)) +
             get_sum_impl(v + v + 1, mid + 1, r, max(mid + 1, L), R);
    }
  }
  long long get_sum(int l, int r) { return get_sum_impl(1, 0, n - 1, l, r); }
};
void run() {
  set<pair<pair<int, int>, int> > st;
  set<pair<pair<int, int>, int> >::iterator itr;
  int n, m;
  scanf("%d%d", &n, &m);
  SegmentTree tree(n + 1);
  for (int i = 1; i <= n; i++) st.insert({{i, i}, i});
  int t, l, r, x;
  while (m--) {
    scanf("%d%d%d", &t, &l, &r);
    if (t == 1) {
      scanf("%d", &x);
      int curl = l, curr = r;
      while (curl <= curr) {
        0 ? (cout << "curl"
                  << " = " << (curl) << ","
                  << "curr"
                  << " = " << (curr) << "\n")
          : cout << "";
        itr = st.lower_bound({{curl, 0}, 0});
        if ((*itr).first.first != curl) itr--;
        int L = curl;
        int R = min(curr, (*itr).first.second);
        int y = (*itr).second;
        0 ? (cout << "L"
                  << " = " << (L) << ","
                  << "R"
                  << " = " << (R) << ","
                  << "y"
                  << " = " << (y) << "\n")
          : cout << "";
        int lastl = (*itr).first.first;
        int lastr = (*itr).first.second;
        st.erase(itr);
        if (lastl < L) st.insert({{lastl, L - 1}, y});
        if (lastr > R) st.insert({{R + 1, lastr}, y});
        tree.add(L, R, abs(y - x));
        curl = R + 1;
      }
      st.insert({{l, r}, x});
    } else {
      printf(0 ? "%lld" : "%I64d", tree.get_sum(l, r));
      putchar('\n');
    }
  }
}
