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;
class SegmentTree {
 public:
  SegmentTree(const int _size = 0) : size(1), tree(vector<Node>()) {
    for (; size < _size; size *= 2)
      ;
    tree = vector<Node>(2 * size, Node(0));
  }
  void AddValue(int from, int to, const long long add) {
    from = max(from, 0);
    to = min(to, size - 1);
    if (from > to) return;
    AddValue(1, 0, size - 1, from, to, add);
  }
  long long QuerySum(int from, int to) {
    from = max(from, 0);
    to = min(to, size - 1);
    if (from > to) return 0;
    return QuerySum(1, 0, size - 1, from, to);
  }

 private:
  class Node {
   public:
    long long sum, add;
    Node(const long long value = 0) : sum(value), add(0) {}
    static Node Merge(const Node &left, const Node &right) {
      return Node(left.sum + right.sum);
    }
  };
  int size;
  vector<Node> tree;
  void Push(const int node, const int left, const int right) {
    int middle = (left + right) / 2;
    if (left == right || tree[node].add == 0) return;
    AddValue(2 * node, left, middle, left, middle, tree[node].add);
    AddValue(2 * node + 1, middle + 1, right, middle + 1, right,
             tree[node].add);
    tree[node] = Node::Merge(tree[2 * node], tree[2 * node + 1]);
  }
  void AddValue(const int node, const int left, const int right, const int from,
                const int to, const long long add) {
    int middle = (left + right) / 2;
    if (from <= left && right <= to) {
      tree[node].add += add;
      tree[node].sum += add * (right - left + 1);
      return;
    }
    Push(node, left, right);
    if (from <= middle) AddValue(2 * node, left, middle, from, to, add);
    if (middle < to) AddValue(2 * node + 1, middle + 1, right, from, to, add);
    tree[node] = Node::Merge(tree[2 * node], tree[2 * node + 1]);
  }
  long long QuerySum(const int node, const int left, const int right,
                     const int from, const int to) {
    int middle = (left + right) / 2;
    if (from <= left && right <= to) return tree[node].sum;
    Push(node, left, right);
    long long sum = 0;
    if (from <= middle) sum += QuerySum(2 * node, left, middle, from, to);
    if (middle < to) sum += QuerySum(2 * node + 1, middle + 1, right, from, to);
    return sum;
  }
};
class Interval {
 public:
  mutable int from, to, colour;
  Interval(const int _from = -1, const int _to = -1, const int _colour = -1)
      : from(_from), to(_to), colour(_colour) {}
  bool operator<(const Interval &other) const {
    if (from != other.from) return from < other.from;
    if (to != other.to) return to < other.to;
    return colour < other.colour;
  }
};
SegmentTree Colourfulness;
set<Interval> Colours;
int N, Q;
inline int Abs(const int value) {
  if (value < 0) return -value;
  return value;
}
inline void UpdateColour(int from, int to, const int colour) {
  from = max(from, 0);
  to = min(to, N - 1);
  if (from > to) return;
  set<Interval>::iterator where = Colours.lower_bound(Interval(from, -1, -1));
  if (where != Colours.begin()) {
    --where;
    Colourfulness.AddValue(max(where->from, from), min(where->to, to),
                           Abs(colour - where->colour));
    if (where->from < from && to < where->to) {
      int splitEnd = where->to, splitColour = where->colour;
      where->to = from - 1;
      Colours.insert(Interval(from, to, colour));
      Colours.insert(Interval(to + 1, splitEnd, splitColour));
      return;
    }
    where->to = min(where->to, from - 1);
    ++where;
  }
  while (where->to <= to) {
    Colourfulness.AddValue(max(where->from, from), min(where->to, to),
                           Abs(colour - where->colour));
    Colours.erase(where);
    where = Colours.lower_bound(Interval(from, -1, -1));
  }
  if (where->from <= to) {
    Colourfulness.AddValue(max(where->from, from), min(where->to, to),
                           Abs(colour - where->colour));
    where->from = max(where->from, to + 1);
  }
  Colours.insert(Interval(from, to, colour));
}
void Solve() {
  for (; Q > 0; --Q) {
    int type, from, to;
    cin >> type >> from >> to;
    --from;
    --to;
    if (type == 1) {
      int colour;
      cin >> colour;
      UpdateColour(from, to, colour);
    } else {
      cout << Colourfulness.QuerySum(from, to) << "\n";
    }
  }
}
void Read() {
  cin >> N >> Q;
  Colourfulness = SegmentTree(N);
  for (int i = 0; i < N; ++i) Colours.insert(Interval(i, i, i + 1));
  Colours.insert(Interval(N, N, -1));
}
int main() {
  Read();
  Solve();
  return 0;
}
