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;
long long N, Q, op, l, r, v, sol;
long long len = 90, cant;
long long A[100100], sum[100100];
bool full[100100];
long long bsum[100100], first[100100], last[100100], xtra[100100];
long long B[100100], pref[100100], suff[100100];
long long calc(long long block) {
  long long base = block * len;
  long long idx = lower_bound(B + base, B + base + len, v) - (B + base);
  long long ret = 0;
  if (idx) ret += (idx * v) - pref[base + idx - 1];
  if (idx < len) ret += suff[base + idx] - ((len - idx) * v);
  return ret;
}
void block_update(long long block) {
  long long base = block * len;
  if (!full[block]) {
    bsum[block] += calc(block);
    first[block] = v;
  } else {
    xtra[block] += abs(last[block] - v);
    bsum[block] += abs(last[block] - v) * len;
    last[block] = v;
  }
  last[block] = v;
  full[block] = true;
}
void block_query(long long block) { sol += bsum[block]; }
void point_update(long long pos) {
  long long block = pos / len;
  if (block < cant) bsum[block] += abs(A[pos] - v);
  sum[pos] += abs(A[pos] - v);
  A[pos] = v;
}
void point_query(long long pos) { sol += sum[pos]; }
void push(long long block) {
  if (!full[block]) return;
  long long base = block * len;
  for (long long I = 0; I < len; I++) {
    long long pos = base + I;
    sum[pos] += abs(A[pos] - first[block]);
    sum[pos] += xtra[block];
    A[pos] = last[block];
  }
  xtra[block] = 0;
  full[block] = false;
}
void pull(long long block) {
  int base = block * len;
  for (int I = 0; I < len; I++) B[base + I] = A[base + I];
  sort(B + base, B + base + len);
  pref[base] = B[base];
  suff[base + len - 1] = B[base + len - 1];
  for (int I = 1; I < len; I++)
    pref[base + I] = pref[base + I - 1] + B[base + I];
  for (int I = len - 2; I >= 0; I--)
    suff[base + I] = suff[base + I + 1] + B[base + I];
}
void border_push() {
  long long block = r / len;
  if (block < cant) {
    push(block);
    pull(block);
  }
  block = l / len;
  if (block < cant) {
    push(block);
    pull(block);
  }
}
void border_pull() {
  long long block = r / len;
  if (block < cant) pull(block);
  block = l / len;
  if (block < cant) pull(block);
}
void paint() {
  border_push();
  long long block = l / len;
  long long pos = l % len;
  for (long long I = l; I <= r;)
    if (pos == 0 && I + len <= r) {
      block_update(block);
      I += len;
      block++;
    } else {
      point_update(I);
      I++, pos++;
      if (pos == len) pos = 0, block++;
    }
  border_pull();
}
void print() {
  sol = 0;
  border_push();
  long long block = l / len;
  long long pos = l % len;
  for (long long I = l, p = l % len; I <= r;)
    if (p == 0 && I + len <= r) {
      block_query(block);
      I += len;
      block++;
    } else {
      point_query(I);
      I++, p++;
      if (p == len) p = 0, block++;
    }
  border_pull();
  cout << sol << "\n";
}
void init() {
  for (long long I = 0; I < N; I++) A[I] = I + 1, B[I] = I + 1;
  cant = N / len;
  for (int block = 0; block < cant; block++) pull(block);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> Q;
  init();
  while (Q--) {
    cin >> op >> l >> r;
    l--, r--;
    if (op == 1) {
      cin >> v;
      paint();
    } else if (op == 2) {
      print();
    } else
      assert(false);
  }
}
