Nagini, being a horcrux You-know-who created with the murder of Bertha Jorkins, has accumulated its army of snakes and is launching an attack on Hogwarts school. 

Hogwarts' entrance can be imagined as a straight line (x-axis) from 1 to 105. Nagini is launching various snakes at the Hogwarts entrance. Each snake lands parallel to the entrance, covering a segment at a distance k from x = l to x = r. Formally, each snake can be imagined as being a line segment between points (l, k) and (r, k). Note that k can be both positive and negative, but not 0.

Let, at some x-coordinate x = i, there be snakes at point (i, y1) and point (i, y2), such that y1 > 0 and y2 < 0. Then, if for any point (i, y3) containing a snake such that y3 > 0, y1 ≤ y3 holds and for any point (i, y4) containing a snake such that y4 < 0, |y2| ≤ |y4| holds, then the danger value at coordinate x = i is y1 + |y2|. If no such y1 and y2 exist, danger value is 0. 

Harry wants to calculate the danger value of various segments of the Hogwarts entrance. Danger value for a segment [l, r) of the entrance can be calculated by taking the sum of danger values for each integer x-coordinate present in the segment.

Formally, you have to implement two types of queries:

  * 1 l r k: a snake is added parallel to entrance from x = l to x = r at y-coordinate y = k (l inclusive, r exclusive). 
  * 2 l r: you have to calculate the danger value of segment l to r (l inclusive, r exclusive). 

Input

First line of input contains a single integer q (1 ≤ q ≤ 5·104) denoting the number of queries.

Next q lines each describe a query. Each query description first contains the query type typei (1 ≤ typei ≤ 2). This is followed by further description of the query. In case of the type being 1, it is followed by integers li, ri and ki (<image>,  - 109 ≤ ki ≤ 109, k ≠ 0). Otherwise, it just contains two integers, li and ri (1 ≤ li < ri ≤ 105).

Output

Output the answer for each query of type 2 in a separate line.

Examples

Input

3
1 1 10 10
1 2 4 -7
2 1 10


Output

34


Input

7
1 2 3 5
1 1 10 10
1 4 5 -5
2 4 8
1 1 10 -10
2 4 8
2 1 10


Output

15
75
170

Note

In the first sample case, the danger value for x-coordinates 1 is 0 as there is no y2 satisfying the above condition for x = 1.

Danger values for x-coordinates 2 and 3 is 10 + | - 7| = 17.

Danger values for x-coordinates 4 to 9 is again 0 as there is no y2 satisfying the above condition for these coordinates.

Thus, total danger value is 17 + 17 = 34.
#include <bits/stdc++.h>
#pragma GCC target("avx,tune=native")
using namespace std;
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto const &vv : V) os << vv << ",";
  os << "]";
  return os;
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  os << "(" << P.first << "," << P.second << ")";
  return os;
}
template <typename T>
inline void print_128(T num) {
  if (!num) return;
  print_128(num / 10);
  cout.put((num % 10) + '0');
}
inline int fstoi(const string &str) {
  auto it = str.begin();
  bool neg = 0;
  int num = 0;
  if (*it == '-')
    neg = 1;
  else
    num = *it - '0';
  ++it;
  while (it < str.end()) num = num * 10 + (*it++ - '0');
  if (neg) num *= -1;
  return num;
}
inline void getch(char &x) {
  while (x = getchar_unlocked(), x < 33) {
    ;
  }
}
inline void getstr(string &str) {
  str.clear();
  char cur;
  while (cur = getchar_unlocked(), cur < 33) {
    ;
  }
  while (cur > 32) {
    str += cur;
    cur = getchar_unlocked();
  }
}
template <typename... Args>
inline void getstr(string &str, Args &...arg) {
  str.clear();
  char cur;
  while (cur = getchar_unlocked(), cur < 33) {
    ;
  }
  while (cur > 32) {
    str += cur;
    cur = getchar_unlocked();
  }
  getstr(arg...);
}
template <typename T>
inline bool sc(T &num) {
  bool neg = 0;
  int c;
  num = 0;
  while (c = getchar_unlocked(), c < 33) {
    if (c == EOF) return false;
  }
  if (c == '-') {
    neg = 1;
    c = getchar_unlocked();
  }
  for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48;
  if (neg) num *= -1;
  return true;
}
template <typename T, typename... Args>
inline void sc(T &num, Args &...args) {
  bool neg = 0;
  int c;
  num = 0;
  while (c = getchar_unlocked(), c < 33) {
    ;
  }
  if (c == '-') {
    neg = 1;
    c = getchar_unlocked();
  }
  for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48;
  if (neg) num *= -1;
  sc(args...);
}
template <typename T>
inline T mod(T i, T n) {
  return (i % n + n) % n;
}
inline void chkmax(int &a, const int &b) {
  if (b > a) a = b;
}
inline void chkmin(int &a, const int &b) {
  if (b < a) a = b;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, l, r, k, t;
  int posa[100001];
  int posb[100001];
  memset(posa, 127, sizeof posa);
  memset(posb, 127, sizeof posb);
  sc(n);
  while (n--) {
    sc(t, l, r);
    --r;
    if (t == 1) {
      sc(k);
      if (k > 0) {
        int count = r - l + 1;
        int n = (count + 7) >> 3;
        int i = l;
        switch (count % 8) {
          case 0:
            do {
              chkmin(posa[i], k);
              ++i;
              case 7:
                chkmin(posa[i], k);
                ++i;
              case 6:
                chkmin(posa[i], k);
                ++i;
              case 5:
                chkmin(posa[i], k);
                ++i;
              case 4:
                chkmin(posa[i], k);
                ++i;
              case 3:
                chkmin(posa[i], k);
                ++i;
              case 2:
                chkmin(posa[i], k);
                ++i;
              case 1:
                chkmin(posa[i], k);
                ++i;
            } while (--n > 0);
        }
      } else {
        k = -k;
        int count = r - l + 1;
        int n = (count + 7) >> 3;
        int i = l;
        switch (count % 8) {
          case 0:
            do {
              chkmin(posb[i], k);
              ++i;
              case 7:
                chkmin(posb[i], k);
                ++i;
              case 6:
                chkmin(posb[i], k);
                ++i;
              case 5:
                chkmin(posb[i], k);
                ++i;
              case 4:
                chkmin(posb[i], k);
                ++i;
              case 3:
                chkmin(posb[i], k);
                ++i;
              case 2:
                chkmin(posb[i], k);
                ++i;
              case 1:
                chkmin(posb[i], k);
                ++i;
            } while (--n > 0);
        }
      }
    } else {
      long long ans = 0;
      int count = r - l + 1;
      int i = l;
      int n = (count + 7) >> 3;
      switch (count % 8) {
        case 0:
          do {
            if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
              ans += posa[i] + posb[i];
            ++i;
            case 7:
              if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
                ans += posa[i] + posb[i];
              ++i;
            case 6:
              if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
                ans += posa[i] + posb[i];
              ++i;
            case 5:
              if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
                ans += posa[i] + posb[i];
              ++i;
            case 4:
              if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
                ans += posa[i] + posb[i];
              ++i;
            case 3:
              if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
                ans += posa[i] + posb[i];
              ++i;
            case 2:
              if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
                ans += posa[i] + posb[i];
              ++i;
            case 1:
              if (posa[i] < 0x7F7F7F7F && posb[i] < 0x7F7F7F7F)
                ans += posa[i] + posb[i];
              ++i;
          } while (--n > 0);
      }
      cout << ans << '\n';
    }
  }
}
