n players are going to play a rock-paper-scissors tournament. As you probably know, in a one-on-one match of rock-paper-scissors, two players choose their shapes independently. The outcome is then determined depending on the chosen shapes: "paper" beats "rock", "rock" beats "scissors", "scissors" beat "paper", and two equal shapes result in a draw.

At the start of the tournament all players will stand in a row, with their numbers increasing from 1 for the leftmost player, to n for the rightmost player. Each player has a pre-chosen shape that they will use in every game throughout the tournament. Here's how the tournament is conducted:

  * If there is only one player left, he is declared the champion.
  * Otherwise, two adjacent players in the row are chosen arbitrarily, and they play the next match. The losing player is eliminated from the tournament and leaves his place in the row (with his former neighbours becoming adjacent). If the game is a draw, the losing player is determined by a coin toss.



The organizers are informed about all players' favoured shapes. They wish to find out the total number of players who have a chance of becoming the tournament champion (that is, there is a suitable way to choose the order of the games and manipulate the coin tosses). However, some players are still optimizing their strategy, and can inform the organizers about their new shapes. Can you find the number of possible champions after each such request?

Input

The first line contains two integers n and q — the number of players and requests respectively (1 ≤ n ≤ 2 ⋅ 10^5, 0 ≤ q ≤ 2 ⋅ 10^5).

The second line contains a string of n characters. The i-th of these characters is "R", "P", or "S" if the player i was going to play "rock", "paper", or "scissors" before all requests respectively.

The following q lines describe the requests. The j-th of these lines contain an integer p_j and a character c_j meaning that the player p_j is going to use the shape described by the character c_j from this moment (1 ≤ p_j ≤ n).

Output

Print q + 1 integers r_0, …, r_q, where r_k is the number of possible champions after processing k requests.

Example

Input


3 5
RPS
1 S
2 R
3 P
1 P
2 P


Output


2
2
1
2
2
3
#include <bits/stdc++.h>
using namespace std;
char getc() {
  char c = getchar();
  while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9'))
    c = getchar();
  return c;
}
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
long long n, m, tree[3][200010], a[200010];
char s[200010];
long long val(char c) {
  if (c == 'R') return 0;
  if (c == 'P') return 1;
  if (c == 'S') return 2;
}
void add(int p, int k, int x) {
  while (k <= n) tree[p][k] += x, k += k & -k;
}
long long query(int p, int k) {
  int s = 0;
  while (k) s += tree[p][k], k -= k & -k;
  return s;
}
set<int> q[3];
int main() {
  cin >> n >> m;
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++)
    add(a[i] = val(s[i]), i, 1), q[val(s[i])].insert(i);
  for (int j = 0, x; j <= m; j++) {
    if (j) {
      cin >> x;
      long long y = val(getc());
      add(a[x], x, -1), add(y, x, 1);
      q[a[x]].erase(x), a[x] = y, q[a[x]].insert(x);
    }
    long long ans = 0;
    for (int i = 0; i < 3; i++) {
      int sc = (i + 2) % 3, pp = (i + 1) % 3;
      if (q[pp].empty())
        ans += query(i, n);
      else if (q[sc].empty())
        ;
      else {
        ans += query(i, n);
        set<int>::iterator it = q[sc].begin();
        int x = *it;
        it = q[sc].end();
        it--;
        int y = *it;
        it = q[pp].begin();
        if ((*it) < x) ans -= query(i, x) - query(i, (*it));
        it = q[pp].end();
        it--;
        if ((*it) > y) ans -= query(i, (*it)) - query(i, y);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
