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>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long normalize(long long x, long long mod) {
  x %= mod;
  if (x < 0) x += mod;
  return x;
}
const long long mod = 1000 * 1000 * 1000 + 7;
const long long INF = 1e18 + 5;
long long powm(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
const long long N = 1e5 + 5;
long long n, m, a[N];
const long long SZ = 320;
struct sqrtDecomposition {
  long long L, R;
  long long col[SZ], contrib[SZ];
  bool lazy = 0;
  long long extra = 0;
  long long sumBlock = 0;
  long long lazyValue = 0;
  void init(long long l, long long r) {
    for (long long i = l; i <= r; i++) {
      col[i - l] = a[i];
      contrib[i] = 0;
    }
    L = l, R = r;
    extra = 0;
    sumBlock = 0;
    lazyValue = 0;
  }
  void semiUpdate(long long l, long long r, long long val) {
    if (l > r) return;
    if (lazy) {
      for (long long i = L; i <= R; i++) {
        contrib[i - L] += extra;
        col[i - L] = lazyValue;
      }
      lazy = 0;
      extra = 0;
    }
    for (long long i = l; i <= r; i++) {
      sumBlock += abs(val - col[i - L]);
      contrib[i - L] += abs(val - col[i - L]);
      col[i - L] = val;
    }
  }
  void fullUpdate(long long val) {
    if (lazy) {
      sumBlock += (abs(val - lazyValue) * (R - L + 1));
      extra += abs(val - lazyValue);
    } else {
      for (long long i = L; i <= R; i++) {
        contrib[i - L] += abs(col[i - L] - val);
        sumBlock += abs(col[i - L] - val);
        col[i - L] = val;
      }
    }
    lazy = 1;
    lazyValue = val;
  }
  void update(long long l, long long r, long long val) {
    if (l <= L && r >= R)
      fullUpdate(val);
    else
      semiUpdate(max(l, L), min(r, R), val);
  }
  long long semiQuery(long long l, long long r) {
    if (l > r) return 0;
    if (lazy) {
      for (long long i = L; i <= R; i++) {
        contrib[i - L] += extra;
        col[i - L] = lazyValue;
      }
      lazy = 0;
      extra = 0;
    }
    long long answer = 0;
    for (long long i = l; i <= r; i++) answer += contrib[i - L];
    return answer;
  }
  long long fullQuery() { return sumBlock; }
  long long query(long long l, long long r) {
    if (l <= L && r >= R)
      return fullQuery();
    else
      return semiQuery(max(l, L), min(r, R));
  }
};
sqrtDecomposition blocks[SZ + 5];
void init() {
  long long blcks = n / SZ + 1;
  long long curL = 1, curR = SZ;
  for (long long i = 1; i <= blcks; i++) {
    curR = min(curR, n);
    blocks[i].init(curL, curR);
    curL += SZ;
    curR += SZ;
  }
}
void update(long long l, long long r, long long x) {
  long long left = (l - 1) / SZ + 1;
  long long right = (r - 1) / SZ + 1;
  for (long long i = left; i <= right; i++) blocks[i].update(l, r, x);
}
long long query(long long l, long long r) {
  long long left = (l - 1) / SZ + 1;
  long long right = (r - 1) / SZ + 1;
  long long answer = 0;
  for (long long i = left; i <= right; i++) answer += blocks[i].query(l, r);
  return answer;
}
void solve() {
  cin >> n >> m;
  for (long long i = (1); i < (n + 1); ++i) {
    a[i] = i;
  }
  init();
  long long type, l, r, x;
  while (m--) {
    cin >> type >> l >> r;
    if (type == 1) {
      cin >> x;
      update(l, r, x);
    } else {
      cout << query(l, r) << "\n";
    }
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
