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 n, m, cnt;
long long tr[400010], tags[400010], tage[400010];
void addtag(long long s, long long e, int x, int l, int r) {
  tr[x] += s * (r - l + 1) + 1ll * (r - l) * (r - l + 1) / 2 * e;
  tags[x] += s, tage[x] += e;
}
void pushdown(int x, int ls, int rs, int l, int mid, int r) {
  if (tage[x] || tags[x]) {
    addtag(tags[x], tage[x], ls, l, mid);
    addtag(tags[x] + tage[x] * (mid - l + 1), tage[x], rs, mid + 1, r);
    tags[x] = tage[x] = 0;
  }
}
void update(int pl, int pr, long long ps, long long pe, int x = 1, int l = 1,
            int r = n) {
  if (l == pl && r == pr) return addtag(ps, pe, x, l, r);
  int mid = (l + r) >> 1, ls = x << 1, rs = x << 1 | 1;
  pushdown(x, ls, rs, l, mid, r);
  if (pr <= mid)
    update(pl, pr, ps, pe, ls, l, mid);
  else if (pl > mid)
    update(pl, pr, ps, pe, rs, mid + 1, r);
  else
    update(pl, mid, ps, pe, ls, l, mid),
        update(mid + 1, pr, ps + (mid - pl + 1) * pe, pe, rs, mid + 1, r);
  tr[x] = tr[ls] + tr[rs];
}
void dfs(int x = 1, int l = 1, int r = n) {
  printf("%d %d %lld %lld %lld\n", l, r, tr[x], tags[x], tage[x]);
  if (l == r) return;
  int mid = (l + r) >> 1, ls = x << 1, rs = x << 1 | 1;
  pushdown(x, ls, rs, l, mid, r);
  dfs(ls, l, mid), dfs(rs, mid + 1, r);
}
long long query(int p, int x = 1, int l = 1, int r = n) {
  if (l == r) return tr[x];
  int mid = (l + r) >> 1, ls = x << 1, rs = x << 1 | 1;
  pushdown(x, ls, rs, l, mid, r);
  if (p <= mid)
    return query(p, ls, l, mid);
  else
    return query(p, rs, mid + 1, r);
}
std::set<std::pair<int, int>> st[200010];
struct node {
  int l, r, x;
  node() : l(), r(), x() {}
  node(int _l, int _r, int _c) : l(_l), r(_r), x(_c) {}
  bool operator<(node const &x) const { return l < x.l; }
};
std::set<node> s;
std::map<int, int> mp;
void insert(int l, int r, int x) {
  s.emplace(l, r, x);
  std::set<std::pair<int, int>>::iterator it = st[x].emplace(l, r).first;
  int pre = (--it)->second;
  ++it;
  int nxt = (++it)->first;
  int k = std::min(l - pre, nxt - r), f = std::max(l - pre, nxt - r);
  update(1, k, r - l + 1, 1);
  if (k != f) {
    update(k + 1, f, k + r - l, 0);
  }
  if (f + 1 <= nxt - pre - 1) update(f + 1, nxt - pre - 1, k + r - l - 1, -1);
}
std::set<node>::iterator split(int pos) {
  std::set<node>::iterator it = s.lower_bound(node(pos, 0, 0));
  if (it->l == pos) return it;
  --it;
  int l = it->l, r = it->r, x = it->x;
  s.erase(it);
  st[x].erase(std::make_pair(l, r));
  st[x].emplace(l, pos - 1), st[x].emplace(pos, r);
  s.emplace(l, pos - 1, x);
  return s.emplace(pos, r, x).first;
}
void erase(int l, int r) {
  std::set<node>::iterator itr = split(r + 1), itl = split(l);
  for (std::set<node>::iterator it = itl; it != itr; ++it) {
    int l = it->l, r = it->r, x = it->x;
    std::set<std::pair<int, int>>::iterator i =
        st[x].find(std::make_pair(l, r));
    int pre = (--i)->second;
    ++i;
    int nxt = (++i)->first;
    st[x].erase(--i);
    int k = std::min(l - pre, nxt - r), f = std::max(l - pre, nxt - r);
    update(1, k, -(r - l + 1), -1);
    if (k != f) {
      update(k + 1, f, -(k + r - l), 0);
    }
    if (f + 1 <= nxt - pre - 1)
      update(f + 1, nxt - pre - 1, -(k + r - l - 1), 1);
  }
  s.erase(itl, itr);
}
int main() {
  scanf("%d%d", &n, &m);
  s.emplace(0, 0, 0), s.emplace(n + 1, n + 1, 0);
  for (int i = 1; i <= n + m; i++)
    st[i].emplace(0, 0), st[i].emplace(n + 1, n + 1);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    if (!mp[x]) mp[x] = ++cnt;
    x = mp[x];
    insert(i, i, x);
  }
  for (int i = 1; i <= m; i++) {
    int op, l, r, x;
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d%d%d", &l, &r, &x);
      erase(l, r);
      if (!mp[x]) mp[x] = ++cnt;
      x = mp[x];
      insert(l, r, x);
    } else {
      scanf("%d", &x);
      printf("%lld\n", query(x));
    }
  }
  return 0;
}