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;
const int MAX = 1e5 + 8;
int color[MAX], n, m;
long long X;
set<pair<int, int> > intervals;
void merge(set<pair<int, int> >::iterator);
struct node {
  long long sum, add, len;
  void merge(node &n1, node &n2) {
    len = n1.len + n2.len;
    sum = n1.sum + n2.sum;
    add = 0;
  }
  void split(node &n1, node &n2) {
    n1.add += add, n2.add += add;
    n1.sum += (long long)n1.len * add, n2.sum += (long long)n2.len * add;
    add = 0;
  }
  node() { sum = add = 0, len = 1LL; }
  void update(long long x) {
    add += x;
    sum += (long long)len * x;
  }
} tree[4 * MAX];
void init(int root, int l, int r) {
  if (l == r) {
    tree[root] = node();
    return;
  }
  int mid = (l + r) / 2;
  init(2 * root, l, mid);
  init(2 * root + 1, mid + 1, r);
  tree[root].merge(tree[2 * root + 1], tree[2 * root]);
}
node range_query(int root, int l, int r, int u, int v) {
  if (u <= l && v >= r) return tree[root];
  int mid = (l + r) / 2;
  tree[root].split(tree[2 * root + 1], tree[2 * root]);
  if (v <= mid) return range_query(2 * root, l, mid, u, v);
  if (u > mid) return range_query(2 * root + 1, mid + 1, r, u, v);
  node n1 = range_query(2 * root, l, mid, u, v);
  node n2 = range_query(2 * root + 1, mid + 1, r, u, v);
  tree[root].merge(tree[2 * root + 1], tree[2 * root]);
  node n;
  n.merge(n1, n2);
  return n;
}
void range_update(int root, int l, int r, int u, int v) {
  if (u <= l && v >= r) {
    tree[root].update(X);
    return;
  }
  tree[root].split(tree[2 * root + 1], tree[2 * root]);
  int mid = (l + r) / 2;
  if (u <= mid) range_update(2 * root, l, mid, u, v);
  if (v > mid) range_update(2 * root + 1, mid + 1, r, u, v);
  tree[root].merge(tree[2 * root + 1], tree[2 * root]);
}
int sa, sb;
void into(int l, int r, int c) {
  if (l <= r) {
    intervals.insert(pair<int, int>(l, r)), color[l] = c;
    if (sa <= l && sb >= r) range_update(1, 1, n, l, r);
  }
}
void in() {
  int a, b, x;
  scanf("%d %d %d", &a, &b, &x);
  sa = a, sb = b;
  while (1) {
    set<pair<int, int> >::iterator it =
        intervals.upper_bound(pair<int, int>(a, 100005));
    it--;
    if (it->first > a || it->second < a || a > b) break;
    pair<int, int> yo = *it;
    X = abs(color[it->first] - x);
    intervals.erase(it);
    int a1 = yo.first, b1 = a - 1, c1 = color[yo.first];
    int a2 = a, b2 = min(b, yo.second), c2 = x;
    int a3 = b + 1, b3 = yo.second, c3 = color[yo.first];
    into(a1, b1, c1), into(a2, b2, c2), into(a3, b3, c3);
    a = b2 + 1;
  }
  a = sa, b = sb;
  while (1) {
    set<pair<int, int> >::iterator it =
        intervals.upper_bound(pair<int, int>(a, 100005));
    it--;
    int b1 = it->second;
    if (it->first > a || it->second < a || a > b) {
      merge(it);
      break;
    }
    merge(it);
    a = b1 + 1;
  }
}
void out() {
  int l, r;
  scanf("%d %d", &l, &r);
  long long val = range_query(1, 1, n, l, r).sum;
  printf("%lld\n", val);
}
int main() {
  scanf("%d %d", &n, &m);
  init(1, 1, n);
  for (int i = 1; i <= n; i++) {
    color[i] = i;
    intervals.insert(pair<int, int>(i, i));
  }
  while (m--) {
    int type;
    scanf("%d", &type);
    if (type == 1)
      in();
    else
      out();
  }
  return 0;
}
void merge(set<pair<int, int> >::iterator it1) {
  if (it1 == intervals.begin()) return;
  set<pair<int, int> >::iterator it2 = it1;
  it2--;
  if (color[it1->first] == color[it2->first]) {
    int a1 = it2->first, b1 = it1->second;
    intervals.erase(it1), intervals.erase(it2);
    intervals.insert(pair<int, int>(a1, b1));
  }
}
