#include <bits/stdc++.h>
using namespace std;
void addmod(int &a, long long b) {
  a = (a + b);
  if (a >= 1000000007) a -= 1000000007;
}
void mulmod(int &a, long long b) { a = (a * b) % 1000000007; }
template <class T>
bool domin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
bool domax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
int gi() {
  int a;
  scanf("%d", &a);
  return a;
}
long long gll() {
  long long a;
  scanf("%lld", &a);
  return a;
}
template <typename T>
class fenwick {
  int n;
  vector<T> a;

 public:
  fenwick(int n = 0) : n(n), a(n + 1, 0) {}
  T getsum(int ix) {
    T ret = 0;
    for (int i = ix; i > 0; i -= (i & (-i))) ret += a[i];
    return ret;
  }
  T getsumbw(int ia, int ib) { return (getsum(ib) - getsum(ia - 1)); }
  void add(int ix, T val) {
    for (int i = ix; i <= n; i += (i & (-i))) a[i] += val;
  }
  T getval(int ix) {
    T ret = a[ix];
    if (ix > 0) {
      int tmp = ix - (ix & (-ix));
      ix--;
      while (ix != tmp) {
        ret -= a[ix];
        ix -= (ix & (-ix));
      }
    }
    return ret;
  }
};
int getix(char c) {
  if (c == 'A') return 0;
  if (c == 'T') return 1;
  if (c == 'G') return 2;
  if (c == 'C') return 3;
  return -1;
}
fenwick<int> vf[4][11][11];
int main() {
  char *s, *es;
  s = new char[100007];
  es = new char[13];
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < 4; i++)
    for (int k = 0; k < 11; k++)
      for (int j = 0; j < 11; j++) {
        vf[i][j][k] = fenwick<int>(n + 1);
      }
  for (int i = 0; i < n; i++)
    for (int j = 1; j < 11; j++) {
      vf[getix(s[i])][j][i % j].add(i + 1, 1);
    }
  int q = gi();
  for (int qi = 0; qi < q; qi++) {
    int t = gi(), l = gi();
    if (t == 1) {
      scanf(" %s", es);
      l--;
      for (int j = 1; j < 11; j++) {
        vf[getix(s[l])][j][l % j].add(l + 1, -1);
        vf[getix(es[0])][j][l % j].add(l + 1, 1);
      }
      s[l] = es[0];
    } else {
      int r;
      scanf("%d %s", &r, es);
      int el = strlen(es), mt = 0;
      for (int j = 0; j < el; j++) {
        int nl = l + j;
        if (nl > r) continue;
        if (nl > n) continue;
        nl--;
        mt += vf[getix(es[j])][el][nl % el].getsumbw(nl + 1, r);
      }
      cout << mt << endl;
    }
  }
  return 0;
}

### Prompt

Please formulate a Cpp solution to the following problem:

Everyone knows that DNA strands consist of nucleotides. There are four types of nucleotides: "A", "T", "G", "C". A DNA strand is a sequence of nucleotides. Scientists decided to track evolution of a rare species, which DNA strand was string s initially. 

Evolution of the species is described as a sequence of changes in the DNA. Every change is a change of some nucleotide, for example, the following change can happen in DNA strand "AAGC": the second nucleotide can change to "T" so that the resulting DNA strand is "ATGC".

Scientists know that some segments of the DNA strand can be affected by some unknown infections. They can represent an infection as a sequence of nucleotides. Scientists are interested if there are any changes caused by some infections. Thus they sometimes want to know the value of impact of some infection to some segment of the DNA. This value is computed as follows:

  * Let the infection be represented as a string e, and let scientists be interested in DNA strand segment starting from position l to position r, inclusive. 
  * Prefix of the string eee... (i.e. the string that consists of infinitely many repeats of string e) is written under the string s from position l to position r, inclusive. 
  * The value of impact is the number of positions where letter of string s coincided with the letter written under it. 



Being a developer, Innokenty is interested in bioinformatics also, so the scientists asked him for help. Innokenty is busy preparing VK Cup, so he decided to delegate the problem to the competitors. Help the scientists!

Input

The first line contains the string s (1 ≤ |s| ≤ 105) that describes the initial DNA strand. It consists only of capital English letters "A", "T", "G" and "C".

The next line contains single integer q (1 ≤ q ≤ 105) — the number of events.

After that, q lines follow, each describes one event. Each of the lines has one of two formats: 

  * 1 x c, where x is an integer (1 ≤ x ≤ |s|), and c is a letter "A", "T", "G" or "C", which means that there is a change in the DNA: the nucleotide at position x is now c. 
  * 2 l r e, where l, r are integers (1 ≤ l ≤ r ≤ |s|), and e is a string of letters "A", "T", "G" and "C" (1 ≤ |e| ≤ 10), which means that scientists are interested in the value of impact of infection e to the segment of DNA strand from position l to position r, inclusive. 

Output

For each scientists' query (second type query) print a single integer in a new line — the value of impact of the infection on the DNA.

Examples

Input

ATGCATGC
4
2 1 8 ATGC
2 2 6 TTT
1 4 T
2 2 6 TA


Output

8
2
4


Input

GAGTTGTTAA
6
2 3 4 TATGGTG
1 1 T
1 6 G
2 5 9 AGTAATA
1 10 G
2 2 6 TTGT


Output

0
3
1

Note

Consider the first example. In the first query of second type all characters coincide, so the answer is 8. In the second query we compare string "TTTTT..." and the substring "TGCAT". There are two matches. In the third query, after the DNA change, we compare string "TATAT..."' with substring "TGTAT". There are 4 matches.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void addmod(int &a, long long b) {
  a = (a + b);
  if (a >= 1000000007) a -= 1000000007;
}
void mulmod(int &a, long long b) { a = (a * b) % 1000000007; }
template <class T>
bool domin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
bool domax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
int gi() {
  int a;
  scanf("%d", &a);
  return a;
}
long long gll() {
  long long a;
  scanf("%lld", &a);
  return a;
}
template <typename T>
class fenwick {
  int n;
  vector<T> a;

 public:
  fenwick(int n = 0) : n(n), a(n + 1, 0) {}
  T getsum(int ix) {
    T ret = 0;
    for (int i = ix; i > 0; i -= (i & (-i))) ret += a[i];
    return ret;
  }
  T getsumbw(int ia, int ib) { return (getsum(ib) - getsum(ia - 1)); }
  void add(int ix, T val) {
    for (int i = ix; i <= n; i += (i & (-i))) a[i] += val;
  }
  T getval(int ix) {
    T ret = a[ix];
    if (ix > 0) {
      int tmp = ix - (ix & (-ix));
      ix--;
      while (ix != tmp) {
        ret -= a[ix];
        ix -= (ix & (-ix));
      }
    }
    return ret;
  }
};
int getix(char c) {
  if (c == 'A') return 0;
  if (c == 'T') return 1;
  if (c == 'G') return 2;
  if (c == 'C') return 3;
  return -1;
}
fenwick<int> vf[4][11][11];
int main() {
  char *s, *es;
  s = new char[100007];
  es = new char[13];
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < 4; i++)
    for (int k = 0; k < 11; k++)
      for (int j = 0; j < 11; j++) {
        vf[i][j][k] = fenwick<int>(n + 1);
      }
  for (int i = 0; i < n; i++)
    for (int j = 1; j < 11; j++) {
      vf[getix(s[i])][j][i % j].add(i + 1, 1);
    }
  int q = gi();
  for (int qi = 0; qi < q; qi++) {
    int t = gi(), l = gi();
    if (t == 1) {
      scanf(" %s", es);
      l--;
      for (int j = 1; j < 11; j++) {
        vf[getix(s[l])][j][l % j].add(l + 1, -1);
        vf[getix(es[0])][j][l % j].add(l + 1, 1);
      }
      s[l] = es[0];
    } else {
      int r;
      scanf("%d %s", &r, es);
      int el = strlen(es), mt = 0;
      for (int j = 0; j < el; j++) {
        int nl = l + j;
        if (nl > r) continue;
        if (nl > n) continue;
        nl--;
        mt += vf[getix(es[j])][el][nl % el].getsumbw(nl + 1, r);
      }
      cout << mt << endl;
    }
  }
  return 0;
}

```