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>
struct SEG {
  int l, r, v;
};
struct LIST {
  int prev, next;
  SEG seg;
} list[1000000];
int num;
void initList() {
  num = 2;
  list[1].next = 0;
  list[0].prev = 1;
  list[0].prev = list[1].next = -1;
}
void set(int x, int l, int r, int v) {
  list[x].seg.l = l;
  list[x].seg.r = r;
  list[x].seg.v = v;
}
void insert(int c, int b) {
  int a = list[c].prev;
  list[a].next = b;
  list[c].prev = b;
  list[b].prev = a;
  list[b].next = c;
}
long long treeSum[1000000], markSum[1000000];
void initSum(int pos, int l, int r) {
  treeSum[pos] = markSum[pos] = 0;
  if (l == r) return;
  int mid = (l + r) / 2;
  initSum(2 * pos, l, mid);
  initSum(2 * pos + 1, mid + 1, r);
}
void spreadSum(int pos, int l, int r) {
  int mid = (l + r) / 2;
  markSum[2 * pos] += markSum[pos];
  markSum[2 * pos + 1] += markSum[pos];
  treeSum[2 * pos] += markSum[pos] * (mid - l + 1);
  treeSum[2 * pos + 1] += markSum[pos] * (r - mid);
  markSum[pos] = 0;
}
void updateSum(int pos, int l, int r, int dl, int dr, int v) {
  if (l > r) {
    puts("errorzzz");
    exit(0);
  }
  if (dl <= l && r <= dr) {
    treeSum[pos] += (long long)(r - l + 1) * v;
    markSum[pos] += v;
    return;
  }
  int mid = (l + r) / 2;
  if (markSum[pos]) spreadSum(pos, l, r);
  if (dl <= mid) updateSum(2 * pos, l, mid, dl, dr, v);
  if (dr > mid) updateSum(2 * pos + 1, mid + 1, r, dl, dr, v);
  treeSum[pos] = treeSum[2 * pos] + treeSum[2 * pos + 1];
}
long long querySum(int pos, int l, int r, int dl, int dr) {
  if (l > r) {
    puts("errorzzz");
    exit(0);
  }
  if (dl <= l && r <= dr) return treeSum[pos];
  int mid = (l + r) / 2;
  if (markSum[pos]) spreadSum(pos, l, r);
  long long sum = 0;
  if (dl <= mid) sum += querySum(2 * pos, l, mid, dl, dr);
  if (dr > mid) sum += querySum(2 * pos + 1, mid + 1, r, dl, dr);
  treeSum[pos] = treeSum[2 * pos] + treeSum[2 * pos + 1];
  return sum;
}
int treePos[1000000], markPos[1000000];
void spreadPos(int pos) {
  treePos[2 * pos] = treePos[2 * pos + 1] = markPos[2 * pos] =
      markPos[2 * pos + 1] = markPos[pos];
  markPos[pos] = 0;
}
void initPos(int pos, int l, int r) {
  markPos[pos] = 0;
  if (l == r) {
    treePos[pos] = l + 1;
    return;
  }
  int mid = (l + r) / 2;
  initPos(2 * pos, l, mid);
  initPos(2 * pos + 1, mid + 1, r);
}
void updatePos(int pos, int l, int r, int dl, int dr, int v) {
  if (l > r) {
    puts("errorzz");
    exit(0);
  }
  if (dl <= l && r <= dr) {
    markPos[pos] = v;
    treePos[pos] = v;
    return;
  }
  int mid = (l + r) / 2;
  if (markPos[pos]) spreadPos(pos);
  if (dl <= mid) updatePos(2 * pos, l, mid, dl, dr, v);
  if (dr > mid) updatePos(2 * pos + 1, mid + 1, r, dl, dr, v);
}
int queryPos(int pos, int l, int r, int x) {
  if (l > r) {
    puts("errorzz");
    exit(0);
  }
  if (l == r) return treePos[pos];
  int mid = (l + r) / 2;
  if (markPos[pos]) spreadPos(pos);
  if (x <= mid)
    return queryPos(2 * pos, l, mid, x);
  else
    return queryPos(2 * pos + 1, mid + 1, r, x);
}
int abs(int x) { return (x < 0) ? -x : x; }
void print(SEG x) {}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  initList();
  initSum(1, 1, n);
  initPos(1, 1, n);
  for (int i = 1; i <= n; i++) {
    set(num, i, i, i);
    insert(0, num);
    num++;
  }
  int p, l, r, v;
  for (int i = 0; i < m; i++) {
    scanf("%d", &p);
    if (p == 1) {
      scanf("%d %d %d", &l, &r, &v);
      int lpos = queryPos(1, 1, n, l), rpos = queryPos(1, 1, n, r);
      print(list[lpos].seg), print(list[rpos].seg);
      int A = list[lpos].prev;
      int C = list[rpos].next;
      list[A].next = C;
      list[C].prev = A;
      int pos = lpos;
      bool flag = false;
      while (1) {
        if (list[pos].seg.l <= l && r <= list[pos].seg.r) {
          if (l != list[pos].seg.l) {
            set(num, list[pos].seg.l, l - 1, list[pos].seg.v);
            updatePos(1, 1, n, list[pos].seg.l, l - 1, num);
            insert(C, num);
            num++;
          }
          set(num, l, r, v);
          updatePos(1, 1, n, l, r, num);
          updateSum(1, 1, n, l, r, abs(v - list[pos].seg.v));
          insert(C, num);
          num++;
          flag = true;
          if (r != list[pos].seg.r) {
            set(num, r + 1, list[pos].seg.r, list[pos].seg.v);
            updatePos(1, 1, n, r + 1, list[pos].seg.r, num);
            insert(C, num);
            num++;
          }
        } else if (list[pos].seg.l < l) {
          set(num, list[pos].seg.l, l - 1, list[pos].seg.v);
          updatePos(1, 1, n, list[pos].seg.l, l - 1, num);
          insert(C, num);
          num++;
          if (num == 1000000) {
            puts("error");
            exit(0);
          }
          updateSum(1, 1, n, l, list[pos].seg.r, abs(v - list[pos].seg.v));
        } else if (list[pos].seg.r > r) {
          set(num, l, r, v);
          updatePos(1, 1, n, l, r, num);
          insert(C, num);
          num++;
          if (num == 1000000) {
            puts("error");
            exit(0);
          }
          flag = true;
          set(num, r + 1, list[pos].seg.r, list[pos].seg.v);
          updatePos(1, 1, n, r + 1, list[pos].seg.r, num);
          insert(C, num);
          num++;
          if (num == 1000000) {
            puts("error");
            exit(0);
          }
          updateSum(1, 1, n, list[pos].seg.l, r, abs(v - list[pos].seg.v));
        } else {
          updateSum(1, 1, n, list[pos].seg.l, list[pos].seg.r,
                    abs(v - list[pos].seg.v));
        }
        if (pos == rpos) break;
        pos = list[pos].next;
      }
      if (!flag) {
        set(num, l, r, v);
        updatePos(1, 1, n, l, r, num);
        insert(C, num);
        num++;
        if (num == 1000000) {
          puts("error");
          exit(0);
        }
      }
    } else {
      scanf("%d %d", &l, &r);
      printf("%I64d\n", querySum(1, 1, n, l, r));
    }
  }
}
