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>
const int N = 1e5 + 7;
using namespace std;
struct node {
  int a, b, lazy;
  long long sum, cnt;
  node *l, *r;
} tree[N + N];
int pos;
node *build(int a, int b) {
  node *root = &tree[++pos];
  root->a = a;
  root->b = b;
  if (root->a == root->b) {
    root->lazy = root->a;
    return root;
  }
  root->lazy = -1;
  int mid = (a + b) >> 1;
  root->l = build(a, mid);
  root->r = build(mid + 1, b);
  return root;
}
void fix(node *root, int x) {
  root->cnt += abs(root->lazy - x);
  root->sum += abs(root->lazy - x) * (root->b - root->a + 1LL);
  root->lazy = x;
}
void spread(node *root) {
  root->l->cnt += root->cnt;
  root->r->cnt += root->cnt;
  root->l->sum += root->cnt * (root->l->b - root->l->a + 1LL);
  root->r->sum += root->cnt * (root->r->b - root->r->a + 1LL);
  root->cnt = 0;
  root->l->lazy = root->r->lazy = root->lazy;
  root->lazy = -1;
}
void mix(node *root) {
  root->sum = root->l->sum + root->r->sum;
  if (root->l->lazy == root->r->lazy) root->lazy = root->l->lazy;
}
void insert(node *root, int a, int b, int x) {
  if (root->lazy >= 0 && root->a >= a && root->b <= b) {
    fix(root, x);
    return;
  }
  int mid = (root->a + root->b) >> 1;
  if (root->lazy != -1) spread(root);
  if (a <= mid) insert(root->l, a, b, x);
  if (b > mid) insert(root->r, a, b, x);
  mix(root);
}
long long find(node *root, int a, int b) {
  if (root->a >= a && root->b <= b) return root->sum;
  int mid = (root->a + root->b) >> 1;
  if (root->lazy != -1) spread(root);
  long long ret = 0;
  if (a <= mid) ret += find(root->l, a, b);
  if (b > mid) ret += find(root->r, a, b);
  mix(root);
  return ret;
}
void check() {
  for (int i = 1; i <= pos; i++) {
    node *root = &tree[i];
    printf("L %d R %d : \n sum %I64d lazy %d cnt %I64d\n", root->a, root->b,
           root->sum, root->lazy, root->cnt);
  }
  puts("-----------\n\n");
}
int main() {
  int n, m, op, l, r, x;
  scanf("%d%d", &n, &m);
  node *root = build(1, n);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &op, &l, &r);
    if (op == 1) {
      scanf("%d", &x);
      insert(root, l, r, x);
    } else
      printf("%I64d\n", find(root, l, r));
  }
  return 0;
}
