Problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were left untouched for centuries, from watching icebergs in freezing weather to scuba-diving in oceans and admiring the sea life, residing unseen. These experiences were enhanced with breathtaking views built by mountains over time and left there for visitors to see for years on end. Over time, all these expeditions took a toll on Sarah and culminated in her decision to settle down in the suburbs and live a quiet life. 

However, as Sarah's love for nature never faded, she started growing flowers in her garden in an attempt to stay connected with nature. At the beginning she planted only blue orchids, but over time she started using different flower types to add variety to her collection of flowers. This collection of flowers can be represented as an array of N flowers and the i-th of them has a type associated with it, denoted as A_i. Each resident, passing by her collection and limited by the width of his view, can only see K contiguous flowers at each moment in time. To see the whole collection, the resident will look at the first K contiguous flowers A_1, A_2, ..., A_K, then shift his view by one flower and look at the next section of K contiguous flowers A_2, A_3, ..., A_{K+1} and so on until they scan the whole collection, ending with section A_{N-K+1}, ..., A_{N-1}, A_N.

Each resident determines the beautiness of a section of K flowers as the number of distinct flower types in that section. Furthermore, the beautiness of the whole collection is calculated by summing the beautiness values of each contiguous section. Formally, beautiness B_i of a section starting at the i-th position is calculated as B_i = distinct(A_i, A_{i+1}, ..., A_{i+K-1}), and beautiness of the collection B is calculated as B=B_1 + B_2 + ... + B_{N-K+1}.

In addition, as Sarah wants to keep her collection of flowers have a fresh feel, she can also pick two points L and R, dispose flowers between those two points and plant new flowers, all of them being the same type.

You will be given Q queries and each of those queries will be of the following two types: 

  1. You will be given three integers L, R, X describing that Sarah has planted flowers of type X between positions L and R inclusive. Formally collection is changed such that A[i]=X for all i in range [L.. R]. 
  2. You will be given integer K, width of the resident's view and you have to determine the beautiness value B resident has associated with the collection 



For each query of second type print the result – beautiness B of the collection.

Input

First line contains two integers N and Q \;(1 ≤ N, Q ≤ 10^5)  — number of flowers and the number of queries, respectively.

The second line contains N integers A_1, A_2, ..., A_N\;(1 ≤ A_i ≤ 10^9)  — where A_i represents type of the i-th flower.

Each of the next Q lines describe queries and start with integer T∈\{1, 2\}. 

  * If T = 1, there will be three more integers in the line L, R, X\;(1 ≤ L, R ≤ N;\; 1 ≤ X ≤ 10^9)  — L and R describing boundaries and X describing the flower type 
  * If T = 2, there will be one more integer in the line K\;(1 ≤ K ≤ N)  — resident's width of view 

Output

For each query of the second type print the beautiness B of the collection.

Example

Input


5 5
1 2 3 4 5
2 3
1 1 2 5
2 4
1 2 4 5
2 2


Output


9
6
4

Note

Let's look at the example.

Initially the collection is [1, 2, 3, 4, 5]. In the first query K = 3, we consider sections of three flowers with the first being [1, 2, 3]. Since beautiness of the section is the number of distinct flower types in that section, B_1 = 3. Second section is [2, 3, 4] and B_2 = 3. Third section is [3, 4, 5] and B_3 = 3, since the flower types are all distinct. The beautiness value resident has associated with the collection is B = B_1 + B_2 + B_3 = 3 + 3 + 3 = 9.

After the second query, the collection becomes [5, 5, 3, 4, 5]. 

For the third query K = 4, so we consider sections of four flowers with the first being [5, 5, 3, 4]. There are three distinct flower types [5, 3, 4] in this section, so B_1 = 3. Second section [5, 3, 4, 5] also has 3 distinct flower types, so B_2 = 3. The beautiness value resident has associated with the collection is B = B_1 + B_2 = 3 + 3 = 6

After the fourth query, the collection becomes [5, 5, 5, 5, 5].

For the fifth query K = 2 and in this case all the four sections are same with each of them being [5, 5]. Beautiness of [5, 5] is 1 since there is only one distinct element in this section [5]. Beautiness of the whole collection is B = B_1 + B_2 + B_3 + B_4 = 1 + 1 + 1 + 1 = 4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
int enlarge(int n) {
  int res = 1;
  while (res < n) {
    res <<= 1;
  }
  return res;
}
struct node {
  int c;
  long long s;
  node() : c(0), s(0) {}
  node(int _c, long long _s) : c(_c), s(_s) {}
  node operator+(const node &rhs) const { return node(c + rhs.c, s + rhs.s); }
};
class segment_tree {
  int n;
  std::vector<node> a;
  void modify(int u, int l, int r, int x, int v) {
    if (l + 1 == r) {
      a[u].c += v;
      a[u].s += 1ll * v * x;
      return;
    }
    int mid = (l + r + 1) >> 1;
    if (x < mid) {
      modify(u << 1, l, mid, x, v);
    } else {
      modify(u << 1 | 1, mid, r, x, v);
    }
    a[u] = a[u << 1] + a[u << 1 | 1];
  }
  node query(int u, int l, int r, int L, int R) {
    if (L <= l && r <= R) {
      return a[u];
    }
    int mid = (l + r + 1) >> 1;
    if (R <= mid) {
      return query(u << 1, l, mid, L, R);
    } else if (L >= mid) {
      return query(u << 1 | 1, mid, r, L, R);
    } else {
      return query(u << 1, l, mid, L, R) + query(u << 1 | 1, mid, r, L, R);
    }
  }

 public:
  segment_tree(int _n) : n(_n), a(enlarge(n) << 1) {}
  void add(int x, int v) { modify(1, 0, n, x, v); }
  node query(int l, int r) { return query(1, 0, n, l, r); }
};
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  int n, q;
  std::cin >> n >> q;
  std::map<int, int> a;
  std::map<int, std::set<std::pair<int, int>>> S;
  a[-1] = a[n] = -1;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  segment_tree Tl(n + 2), Tr(n + 2), Tn(n + 2);
  long long ans = 0;
  int cnt = 0;
  auto add = [&](int i, int j, int p, int v) {
    Tl.add(i - p, v);
    Tr.add(n - j, v);
    Tn.add(n - p, v);
    ans += 1ll * (j - p) * v;
  };
  auto insert = [&](std::set<std::pair<int, int>> &S, int l, int r) {
    auto it = S.lower_bound(std::make_pair(r + 1, 0));
    int lst = it == S.begin() ? -1 : std::prev(it)->second;
    if (it != S.end()) {
      add(it->first, it->second, lst, -1);
      add(it->first, it->second, r, 1);
    }
    add(l, r, lst, 1);
    S.emplace(l, r);
  };
  auto erase = [&](std::set<std::pair<int, int>> &S, int l, int r) {
    auto it = S.find(std::make_pair(l, r)), nx = std::next(it);
    int lst = it == S.begin() ? -1 : std::prev(it)->second;
    if (nx != S.end()) {
      add(nx->first, nx->second, r, -1);
      add(nx->first, nx->second, lst, 1);
    }
    add(l, r, lst, -1);
    S.erase(it);
  };
  for (int i = 0; i < n; ++i) {
    insert(S[a[i]], i, i);
  }
  while (q--) {
    int op;
    std::cin >> op;
    if (op == 1) {
      int l, r, x;
      std::cin >> l >> r >> x;
      --l, --r;
      auto it = a.lower_bound(l);
      int lst = std::prev(it)->first;
      int pl = lst, cl = it->second;
      while (it->first <= r) {
        erase(S[it->second], lst + 1, it->first);
        lst = it->first;
        it = a.erase(it);
      }
      int pr = it->first, cr = it->second;
      if (pr < n) {
        erase(S[cr], lst + 1, pr);
      }
      if (pl < l - 1) {
        insert(S[cl], pl + 1, l - 1);
        a[l - 1] = cl;
      }
      insert(S[x], l, r);
      a[r] = x;
      if (pr < n) {
        insert(S[cr], r + 1, pr);
      }
    } else {
      int k;
      std::cin >> k;
      node pl = Tl.query(0, k), sl = Tl.query(k, n + 2);
      node pr = Tr.query(0, k), sr = Tr.query(k, n + 2);
      node pn = Tn.query(0, k);
      std::cout << ans - 1ll * pl.c * k - sl.s + pr.s + 1ll * sr.c * k +
                       1ll * pn.c * k - pn.s
                << "\n";
    }
  }
}