import java.io.*;
import java.util.*;

public class Main implements Runnable {
	FastReader scn;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		int n = scn.nextInt(), q = scn.nextInt();
		char[] str = scn.next().toCharArray();
		int[] arr = new int[n];
		for(int i = 1; i < n; i++) {
			if(str[i] == 'C' && str[i - 1] == 'A') {
				arr[i]++;
			}
			arr[i] += arr[i - 1];
		}
		while(q-- > 0) {
			int l = scn.nextInt(), r = scn.nextInt() - 1;
			if(l > r) {
				out.println(0);
			} else {
				int rv = arr[r] - arr[l - 1];
				out.println(rv);
			}
		}
	}

	int[][] packU(int n, int[] from, int[] to) {
		int[][] g = new int[n][];
		int[] p = new int[n];
		for (int f : from)
			p[f]++;
		for (int t : to)
			p[t]++;
		for (int i = 0; i < n; i++)
			g[i] = new int[p[i]];
		for (int i = 0; i < from.length; i++) {
			g[from[i]][--p[from[i]]] = to[i];
			g[to[i]][--p[to[i]]] = from[i];
		}
		return g;
	}

	boolean f(int a, int b) {
		int c = 0;
		for (int i = 0; i < 10; i++) {
			if (((a >> i) & 1) != ((b >> i) & 1)) {
				c++;
			}
		}
		return c == 1;
	}

	public void run() {
		long time = System.currentTimeMillis();
		boolean oj = true;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Main(), "Main", 1 << 26).start();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}

		long[] uniq(long[] arr) {
			Arrays.sort(arr);
			long[] rv = new long[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}

		int[] reverse(int[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}
	}
}


import java.io.*;
import java.util.*;

public class Main implements Runnable {
	FastReader scn;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		int n = scn.nextInt(), q = scn.nextInt();
		char[] str = scn.next().toCharArray();
		int[] arr = new int[n];
		for (int i = 1; i < n; i++) {
			if (str[i] == 'C' && str[i - 1] == 'A') {
				arr[i]++;
			}
			arr[i] += arr[i - 1];
		}
		while (q-- > 0) {
			out.println(-arr[scn.nextInt() - 1] + arr[scn.nextInt() - 1]);
		}
	}

	int[][] packU(int n, int[] from, int[] to) {
		int[][] g = new int[n][];
		int[] p = new int[n];
		for (int f : from)
			p[f]++;
		for (int t : to)
			p[t]++;
		for (int i = 0; i < n; i++)
			g[i] = new int[p[i]];
		for (int i = 0; i < from.length; i++) {
			g[from[i]][--p[from[i]]] = to[i];
			g[to[i]][--p[to[i]]] = from[i];
		}
		return g;
	}

	boolean f(int a, int b) {
		int c = 0;
		for (int i = 0; i < 10; i++) {
			if (((a >> i) & 1) != ((b >> i) & 1)) {
				c++;
			}
		}
		return c == 1;
	}

	public void run() {
		long time = System.currentTimeMillis();
		boolean oj = true;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Main(), "Main", 1 << 26).start();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}

		long[] uniq(long[] arr) {
			Arrays.sort(arr);
			long[] rv = new long[arr.length];
			int pos = 0;
			rv[pos++] = arr[0];
			for (int i = 1; i < arr.length; i++) {
				if (arr[i] != arr[i - 1]) {
					rv[pos++] = arr[i];
				}
			}
			return Arrays.copyOf(rv, pos);
		}

		int[] reverse(int[] arr) {
			int l = 0, r = arr.length - 1;
			while (l < r) {
				arr[l] = arr[l] ^ arr[r];
				arr[r] = arr[l] ^ arr[r];
				arr[l] = arr[l] ^ arr[r];
				l++;
				r--;
			}
			return arr;
		}
	}
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			int q = sc.nextInt();
			char[] S = sc.next().toCharArray();
			char[] s = new char[n+1];
			int[] l = new int[q];
			int[] r = new int[q];
			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i=1;i<=n;i++) {
				s[i] = S[i-1];
				if(i>1&&s[i]=='C'&&s[i-1]=='A') {
					list.add(i-1);
				}
			}

			Collections.sort(list);

			for(int i=0;i<q;i++) {
				l[i] = sc.nextInt();
				r[i] = sc.nextInt();
			}

			for(int i=0;i<q;i++) {
				int ret = 0;
				if((l[i]+1)==r[i]) {
					System.out.println(ret);
					continue;
				}

				for(int j=0;j<list.size();j++) {

					if(list.get(j)>=r[i]) {
						break;
					}

					if(l[i]<=list.get(j)&&list.get(j)<r[i]) {
						ret++;
					}
				}

				System.out.println(ret);
			}

	    }

	}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			int q = sc.nextInt();
			char[] S = sc.next().toCharArray();
			char[] s = new char[n+1];
			int[] l = new int[q];
			int[] r = new int[q];
			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i=1;i<=n;i++) {
				s[i] = S[i-1];
				if(i>1&&s[i]=='C'&&s[i-1]=='A') {
					list.add(i-1);
				}
			}

			Collections.sort(list);

			for(int i=0;i<q;i++) {
				l[i] = sc.nextInt();
				r[i] = sc.nextInt();
			}

			for(int i=0;i<q;i++) {
				int ret = 0;
				for(int j=0;j<list.size();j++) {

					if(list.get(j)>=r[i]) {
						break;
					}

					if(l[i]<=list.get(j)&&list.get(j)<r[i]) {
						ret++;
					}
				}

				System.out.println(ret);
			}

	    }

	}


import java.util.ArrayList;
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			int q = sc.nextInt();
			char[] S = sc.next().toCharArray();
			char[] s = new char[n+1];
			int[] l = new int[q];
			int[] r = new int[q];
			ArrayList<Integer> list = new ArrayList<Integer>();

			for(int i=1;i<=n;i++) {
				s[i] = S[i-1];
				if(i>1&&s[i]=='C'&&s[i-1]=='A') {
					list.add(i-1);
				}
			}

			for(int i=0;i<q;i++) {
				l[i] = sc.nextInt();
				r[i] = sc.nextInt();
			}

			for(int i=0;i<q;i++) {
				int ret = 0;
				for(int j=0;j<list.size();j++) {
					if(l[i]<=list.get(j)&&list.get(j)<r[i]) {
						ret++;
					}
				}

				System.out.println(ret);
			}

	    }

	}


#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	int N = getint(), Q = getint();

	int AC[100000];
	AC[0] = 0;
	rep(i, N - 1) {
		AC[i + 1] = AC[i];
		if (*ci++ == 'A' && *ci == 'C') AC[i + 1]++;
	}
	ci += 2;
	rep(i, Q) {
		int l = getint(), r = getint();
		putint(AC[r - 1] - AC[l - 1]);
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N = getint(), Q = getint();

	int AC[100000];
	AC[0] = 0;
	rep(i, N - 1) {
		AC[i + 1] = AC[i];
		if (*ci++ == 'A' && *ci == 'C') AC[i + 1]++;
	}
	ci += 2;
	rep(i, Q) {
		int l = getint(), r = getint();
		putint(AC[r - 1] - AC[l - 1]);
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
  if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
  return *ci++;
}

inline int getint() {
  int A = 0;
  if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
  else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
  return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn;

inline void putint(int X) {
  if (X == 0) {
    *di++ = '0';
    *di++ = '\n';
    return;
  }
  int keta = 0;
  char C[10];
  while (X) {
    *(C + keta) = '0' + X % 10;
    X /= 10;
    keta++;
  }
  for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
  *di++ = '\n';
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n = getint(), q = getint();
  vector<int> arr(n);
  arr[0] = 0;
  for (int i = 0; i < n - 1; ++i) {
    arr[i + 1] = arr[i];
    if (*ci++ == 'A' && *ci =='C') ++arr[i + 1];
  }
  ci += 2;
  for (int i = 0; i < q; ++i) {
    int left = getint(), right = getint();
    putint(arr[right - 1] - arr[left - 1]);
  }
  fwrite_unlocked(dn, di - dn, 1, stdout);
}


#include <bits/stdc++.h>
using namespace std;

#define printl(s) cout << s << endl;
#define print(s) cout << s << endl; return 0;
#define yes cout << "Yes" << endl; return 0;
#define no cout << "No" << endl; return 0;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)
using ll = long long;

const ll modseed = pow(10,9) + 7;

template <typename T>
vector<T> getValues(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
int N, cnt;

int main(){
  cin >> S;
  int len = 0;
  string t = "ACGT";
rep(i,t.size()){
  printl(t.at(i));
}
  rep(i,S.size()){
    if(S.at(i)== t.at(0) ||S.at(i)== t.at(1) ||S.at(i)== t.at(2) ||S.at(i)== t.at(3)){
      len++;
      cnt = max(len,cnt);
    }else{
      len=0;
    }
  }
  print(cnt);
}


#include <bits/stdc++.h>
using namespace std;

#define printl(s) cout << s << endl;
#define print(s) cout << s << endl; return 0;
#define yes cout << "Yes" << endl; return 0;
#define no cout << "No" << endl; return 0;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)
using ll = long long;

const ll modseed = pow(10,9) + 7;

template <typename T>
vector<T> getValues(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
int N, cnt;

int main(){
  cin >> S;
  int len = 0;
  string t = "ACGT";
  rep(i,S.size()){
    if(S.at(i)== t.at(0) ||S.at(i)== t.at(1) ||S.at(i)== t.at(2) ||S.at(i)== t.at(3)){
      len++;
            cnt = max(len,cnt);
    }else{
      len=0;
    }
  }
  print(cnt);
}


#include <iostream>
#include <string>
using namespace std;

int main(){
  int N, Q;
  string S;
  cin >> N >> Q >> S;

  for(int i = 0;i < Q;i++){
    int l, r;
    cin >> l >> r;

    int cnt = 0;
    for(int j = l;j < r;j++) if(S.at(j-1) == 'A' && S.at(j) == 'C') cnt++;
    cout << cnt << endl;
  }

  return 0;
}


// AtCoder ABC122: C - GeT AC
// 2019.9.9 bal4u

#include <stdio.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in() {   // 非負整数の入力
	int n = 0; int c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void out(int n) { // 非負整数の表示（出力）
	int i; char b[30];

	if (!n) pc('0');
	else {
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

void ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

int  N;
int  a[100005];
char S[100005];

int main()
{
	int i, Q;

	N = in(), Q = in(), ins(S+1);
	for (i = 2; i <= N; i++) {
		if (S[i-1] == 'A' && S[i] == 'C') a[i] = a[i-1]+1;
		else a[i] = a[i-1];
	}

	while (Q--) {
		int l = in(), r = in();
		if (l == 1) out(a[r]);
		else if (a[l] != a[l-1]) out(a[r]-a[l-1]-1);
		else out(a[r]-a[l-1]);
	}
	return 0;
}


typedef long unsigned int size_t;
extern int printf (const char *__restrict __format, ...);
extern int scanf (const char *__restrict __format, ...) ;
extern int getchar (void);
extern int putchar (int __c);
int nextInt(){int f=0;char s=0;char c=getchar();while((c<48)||(57<c)){if(c==45){s=1;c=getchar();break;}c=getchar();}while((48<=c)&&(c<=57)){f=f*10+(c-48);c=getchar();}return s?-f:f;}
char nextChar(){char f=0;char s=0;char c=getchar();while((c<48)||(57<c)){if(c==45){s=1;c=getchar();break;}c=getchar();}while((48<=c)&&(c<=57)){f=f*10+(c-48);c=getchar();}return s?-f:f;}
short int nextShort(){short f=0;char s=0;char c=getchar();while((c<48)||(57<c)){if(c==45){s=1;c=getchar();break;}c=getchar();}while((48<=c)&&(c<=57)){f=f*10+(c-48);c=getchar();}return s?-f:f;}
long long int nextLong(){long long int f=0;char s=0;char c=getchar();while((c<48)||(57<c)){if(c==45){s=1;c=getchar();break;}c=getchar();}while((48<=c)&&(c<=57)){f=f*10+(c-48);c=getchar();}return s?-f:f;}
void println(){putchar(10);}
void print(char *f){while(*f){putchar(*f);f++;}}
void printInt(int f){char c[10];if(!f){putchar(48);return;}if(f<0){f=-f;putchar(45);}char i=0;while(f){c[++i]=(f%10)+48;f/=10;}while(i){putchar(c[i--]);}}
void printLong(long long int f){char c[19];if(!f){putchar(48);return;}if(f<0){f=-f;putchar(45);}char i=0;while(f){c[++i]=(f%10)+48;f/=10;}while(i){putchar(c[i--]);}}
int n, q, i;
int l, r;
char s[100001], c;
int a[100001];
int main(void){
 n=nextInt();
 q=nextInt();
 s[0]=getchar();
 for(i=1; i<n; i++){
  s[i]=getchar();
  if(s[i-1]=='A' && s[i]=='C'){a[i]=1;}
  a[i] += a[i-1];
 }
 for(i=0; i<q; i++){
  l=nextInt()-1;
  r=nextInt()-1;
  printInt(a[r]-a[l]); println();
 }
}


// Using fgets(3) and strtol(3) to obtain integers.
// It may be faster than scanf(3) version sometimes.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

int64_t solve(char *begin, char *end);

int main(int argc, char const* argv[])
{
  char *next;
  int64_t N, Q;
  char buf[32];
  fgets(buf, sizeof(buf), stdin);
  N = strtol(buf, &next, 10);
  Q = strtol(next + 1, NULL, 10);
  // fprintf(stderr, "N = %ld, Q = %ld\n", N, Q);

  char *S = malloc((size_t)N + 2);
  fgets(S, N + 2, stdin);
  S[N + 1] = '\0';
  S[N] = '\0';
  // getchar();

  int64_t R[N];
  memset(R, 0, 8 * N);
  for (int i = 0; i < N - 1; i++) {
    R[i + 1] = R[i] + (((S[i] == 'A') && (S[i + 1] == 'C')) ? 1 : 0);
  }

  int64_t l, r, res;

  for (int i = 0; i < Q; i++) {
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), stdin);
    l = strtol(buf, &next, 10);
    r = strtol(next + 1, NULL, 10);
    res = R[r - 1] - R[l - 1];
    printf("%lu\n", res);
  }

  /*
  // Bad code! TLE
  for (int i = 0; i < Q; i++) {
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), stdin);
    l = strtol(buf, &next, 10);
    r = strtol(next + 1, NULL, 10);
    res = solve(S + l - 1, S + r - 1);
    printf("%lu\n", res);

  }
  */
  free(S);
  return 0;
}

int64_t solve(char *begin, char *end) {
  int64_t res = 0;
  for (; begin < end; begin++) {
    if ((begin[0] == 'A') && (begin[1] == 'C')) {
      res++;
      begin++;
    }
  }
  return res;
}


#pragma warning(disable:4996)
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 100000

int main() {

	char sInput[100]="";
	char sTargetString[MAX_STRING+1]="";
	char* psInput=NULL;
	int anStart[MAX_STRING];
	int anEnd[MAX_STRING];
	int anScore[MAX_STRING];
	int anAcFoundIndex[MAX_STRING];
	int i=0;
	int j=0;
	int nStrLength=0;
	int nParaNumber=0;
	int nNowStart=0;
	int nNowEnd=0;
	int nFoundCount=0;

/*	for(i=0;i<MAX_STRING;i++){
		anStart[i]=0;
		anEnd[i]=0;
		anScore[i]=0;
		anAcFoundIndex[i]=0;
	}*/

	// read line 1
	gets(sInput);
	psInput=strtok(sInput," ");
	nStrLength=atoi(psInput);
	psInput=strtok(NULL," ");
	nParaNumber=atoi(psInput);

	// read line 2
	gets(sTargetString);

	// read line 3 and lator
	for(i=0;i<nParaNumber;i++){
		gets(sInput);
		psInput=strtok(sInput," ");
		anStart[i]=atoi(psInput);
		psInput=strtok(NULL," ");
		anEnd[i]=atoi(psInput);
	}

	// check"AC"
	for(i=1;i<nStrLength;i++){
		if(sTargetString[i-1]=='A' && sTargetString[i]=='C'){
			anAcFoundIndex[nFoundCount]=i-1;
			nFoundCount++;
		}
	}

	for(i=0;i<nFoundCount;i++){
		for(j=0;j<nParaNumber;j++){
			if((anStart[j]-1)<=anAcFoundIndex[i] && (anAcFoundIndex[i]+1)<=(anEnd[j]-1)){
				anScore[j]=anScore[j]+1;
			}
		}
	}

	for(i=0;i<nParaNumber;i++){
		printf("%d\n",anScore[i]);
	}

    return 0;
}


#pragma warning(disable:4996)
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 100000

int main() {

	char sInput[MAX_STRING+1]="";
	char sTargetString[MAX_STRING+1]="";
	char* psInput=NULL;
	int anStart[MAX_STRING];
	int anEnd[MAX_STRING];
	int anScore[MAX_STRING];
	int anAcFoundIndex[MAX_STRING];
	int i=0;
	int j=0;
	long long nK=0;
	int nStrLength=0;
	int nParaNumber=0;
	int nNowStart=0;
	int nNowEnd=0;
	int nFoundCount=0;

	for(i=0;i<MAX_STRING;i++){
		anStart[i]=0;
		anEnd[i]=0;
		anScore[i]=0;
		anAcFoundIndex[i]=0;
	}

	// read line 1
	gets(sInput);
	psInput=strtok(sInput," ");
	nStrLength=atoi(psInput);
	psInput=strtok(NULL," ");
	nParaNumber=atoi(psInput);

	// read line 2
	gets(sTargetString);

	// read line 3 and lator
	for(i=0;i<nParaNumber;i++){
		gets(sInput);
		psInput=strtok(sInput," ");
		anStart[i]=atoi(psInput);
		psInput=strtok(NULL," ");
		anEnd[i]=atoi(psInput);
	}

	// check"AC"
	for(i=1;i<nStrLength;i++){
		if(sTargetString[i-1]=='A' && sTargetString[i]=='C'){
			anAcFoundIndex[nFoundCount]=i-1;
			nFoundCount++;
		}
	}

	for(i=0;i<nFoundCount;i++){
		for(j=0;j<nParaNumber;j++){
			if((anStart[j]-1)<=anAcFoundIndex[i] && (anAcFoundIndex[i]+1)<=(anEnd[j]-1)){
				anScore[j]=anScore[j]+1;
			}
		}
	}

	for(i=0;i<nParaNumber;i++){
		printf("%d\n",anScore[i]);
	}

    return 0;
}


#pragma warning(disable:4996)
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 100000

int main() {

	char sInput[MAX_STRING+1]="";
	char sTargetString[MAX_STRING+1]="";
	char* psInput=NULL;
	int anStart[MAX_STRING];
	int anEnd[MAX_STRING];
	int anScore[MAX_STRING];
	int i=0;
	int j=0;
	long long nK=0;
	int nStrLength=0;
	int nParaNumber=0;
	int nNowStart=0;
	int nNowEnd=0;

	for(i=0;i<MAX_STRING;i++){
		anStart[i]=0;
		anEnd[i]=0;
		anScore[i]=0;
	}

	// read line 1
	gets(sInput);
	psInput=strtok(sInput," ");
	nStrLength=atoi(psInput);
	psInput=strtok(NULL," ");
	nParaNumber=atoi(psInput);

	// read line 2
	gets(sTargetString);

	// read line 3 and lator
	for(i=0;i<nParaNumber;i++){
		gets(sInput);
		psInput=strtok(sInput," ");
		anStart[i]=atoi(psInput);
		psInput=strtok(NULL," ");
		anEnd[i]=atoi(psInput);
	}

	// check"AC"
	for(i=1;i<nStrLength;i++){
		if(sTargetString[i-1]=='A' && sTargetString[i]=='C'){
			nNowStart=i-1;
			nNowEnd=i;

			for(j=0;j<nParaNumber;j++){
				if((anStart[j]-1)<=nNowStart && nNowEnd<=(anEnd[j]-1)){
					anScore[j]=anScore[j]+1;
				}
			}
		}
	}

	for(i=0;i<nParaNumber;i++){
		printf("%d\n",anScore[i]);
	}

    return 0;
}


'use strict'
function Main(input){
  input=input.trim().split(/\s+/);
  var N=input.shift()-0;
  var Q=input.shift()-0;
  var S='';
  var b=/A|T|G|C/;
  while(b.test(input[0]))
    S=S+input.shift();
  S=S.split('');
//  console.log(S);
  var T=[0,0];
  for(let i=1;i<N;i++)
    T[i+1]=T[i]+(S[i-1]==='A'&&S[i]==='C'?1:0);
//  console.log(T);
  var ans=[];
  for(let q=0;q<Q;q++){
    let l=input[2*q]-0,r=input[2*q+1]-0;
    ans[q]=T[r]-T[l];
  }
  console.log(ans.join('\n'));
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.split("\n");
var nq=arr[0].split(" ").map(Number);
var str = arr[1];
var a=[0,0];
var cnt=0;
for(var i=1;i<str.length;i++){
   if(str[i]=="C" && str[i-1]=="A")cnt++;
   a.push(cnt);
}
var ans=[];
for(var i=2;i<nq[1]+2;i++){
   var lr=arr[i].split(" ");
   ans.push(a[lr[1]-0]-a[lr[0]-0]);
}
console.log(ans.join("\n"));


input = require('fs').readFileSync('/dev/stdin', 'utf8');
arr=input.split("\n");
nq=arr[0].split(" ").map(Number);
str = arr[1];
a=[0,0];
cnt=0;
for(i=1;i<str.length;i++){
   if(str[i]=="C" && str[i-1]=="A")cnt++;
   a.push(cnt);
}
ans=[];
for(i=2;i<nq[1]+2;i++){
   lr=arr[i].split(" ");
   ans.push(a[lr[1]-0]-a[lr[0]-0]);
}
console.log(ans.join("\n"));


function Main(input){
    const arr = input.split('\n');
    const NQ = arr[0].split(' ').map(Number);
    const S = arr[1];
    const lq = [];
    let answer = [];
    for(let i=2; i<arr.length; i++){
        lq.push(arr[i]);
    }
    for(let i=0; i<lq.length; i++){
        let num = 0;
        const left = lq[i].split(' ')[0];
        const right = lq[i].split(' ')[1];
        const string = S.slice(left-1, right);
        let j=0;
        while(true){
            const index = string.indexOf('AC', j);
            if(index>=0){
                num++;
                j = index+1;
            } else {
                break;
            }
        }
        answer.push(num)
    }
    console.log(answer.join('\n'));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input){
    const arr = input.split('\n');
    const NQ = arr[0].split(' ').map(Number);
    const S = arr[1];
    const lq = [];
    let answer = 0;
    for(let i=2; i<arr.length; i++){
        lq.push(arr[i]);
    }
    for(let i=0; i<lq.length; i++){
        answer = 0;
        const left = lq[i].split(' ')[0];
        const right = lq[i].split(' ')[1];
        const string = S.slice(left-1, right);
        let j=0;
        while(true){
            const index = string.indexOf('AC', j);
            if(index>=0){
                answer++;
                j = index+1;
            } else {
                break;
            }
        }
        console.log(answer);
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, Q] = nextIntArray()
    const s = next()
    let l = []
    let r = []
    let agg = new Array(N).fill(0)
    let sum = 0
    agg[0] = 0
    for(let i = 1; i<N; i++){
        if(s[i] == "C" && s[i-1] == "A"){
            sum++
        }
        agg[i] = sum
    }
    console.log(agg)
    while(hasNext()){
        let tmp = nextIntArray()
        l.push(tmp[0]-1)
        r.push(tmp[1]-1)
    }
    let ans = []
    for(let i = 0; i<l.length;i++){
        ans.push(agg[r[i]]-agg[l[i]])
    }
    console.log(ans.join("\n"))
}
Main()


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func init() {
	buf := make([]byte, 0)
	scanner.Buffer(buf, 10000000000)
	scanner.Split(bufio.ScanWords)
}

func ScanText() string {
	if scanner.Scan() {
		return scanner.Text()
	}
	_, _ = fmt.Fprintf(os.Stderr, "Text not found")
	return ""
}

func ScanInt() (ret int) {
	var err error
	if scanner.Scan() {
		txt := scanner.Text()
		if ret, err = strconv.Atoi(txt); err != nil {
			_, _ = fmt.Fprintf(os.Stderr, err.Error())
		}
	}
	return
}

func main() {
	n, q := ScanInt(), ScanInt()
	s := ScanText()

	cur := 0
	t := make([]int, n)
	for i := 1; i < n; i++ {
		if s[i-1] == 'A' && s[i] == 'C' {
			cur++
		}
		t[i] = cur
	}

	var w = bufio.NewWriter(os.Stdout)
	for i := 0; i < q; i++ {
		l, r := ScanInt()-1, ScanInt()-1
		_, _ = fmt.Fprintln(w, t[r]-t[l])
	}
	_ = w.Flush()
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var n, q int
	var t string
	s := wordScanner(100001)
	scanInts(s, &n, &q)
	scanStrings(s, &t)

	l, r := make([]int, q), make([]int, q)
	for i := 0; i < q; i++ {
		scanInts(s, &l[i], &r[i])
	}

	count := make([]int, n)
	for i := 1; i < n; i++ {
		count[i] = count[i-1]
		if t[i-1:i+1] == "AC" {
			count[i]++
		}
	}

	ans := make([]string, q)
	for i := 0; i < q; i++ {
		ans[i] = strconv.Itoa(count[r[i]-1] - count[l[i]-1])
	}

	fmt.Println(strings.Join(ans, "\n"))
}

func wordScanner(n int) *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	b := make([]byte, n)
	s.Buffer(b, n)
	return s
}

func scanInts(s *bufio.Scanner, vals ...*int) {
	for i := range vals {
		s.Scan()
		n, _ := strconv.Atoi(s.Text())
		*vals[i] = n
	}
}

func scanStrings(s *bufio.Scanner, vals ...*string) {
	for i := range vals {
		s.Scan()
		*vals[i] = s.Text()
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type pair struct {
	l, r int
}

func m() {
	n, q := getInt(), getInt()
	s := []rune(getString())
	ps := make([]pair, q)
	for i := range ps {
		ps[i].l = getInt() - 1
		ps[i].r = getInt() - 1
	}

	cSum := make([]int, n+1)
	for i := 0; i < n; i++ {
		if (i < n-1) && (s[i] == 'A') && (s[i+1] == 'C') {
			cSum[i+1] = cSum[i] + 1
		} else {
			cSum[i+1] = cSum[i]
		}
	}

	for _, p := range ps {
		res := cSum[p.r] - cSum[p.l]
		puts(res)
	}
}

// -----------------------------------------

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
)

func main() {
	buf := 200001
	scanner.Buffer(make([]byte, buf), buf)
	scanner.Split(bufio.ScanWords)
	m()
	writer.Flush()
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}

func puts(a ...interface{}) {
	if _, err := fmt.Fprintln(writer, a...); err != nil {
		panic(err)
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - GeT AC
	var N, Q int
	fmt.Scan(&N, &Q)
	var S string
	fmt.Scan(&S)

	var count int
	var flag int
	sum := make([]int, N)
	for i := 0; i < N; i++ {
		if S[i] == 'A' {
			flag = 1
		} else if S[i] == 'C' && flag == 1 {
			count++
		} else {
			flag = 0
		}

		sum[i] = count
	}

	var l, r int

	sc.Split(bufio.ScanWords)
	for i := 0; i < Q; i++ {
		l = nextInt()
		r = nextInt()
		fmt.Println(sum[r-1] - sum[l-1])

	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var N, Q int
var S string
var MEMO [][]int

func main() {
	var w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	N = nextInt()
	Q = nextInt()
	S = nextString()
	MEMO = make([][]int, N)
	for i := 0; i < N; i++ {
		MEMO[i] = make([]int, N+1)
	}
	solve(0, 2)
	for i := 0; i < Q; i++ {
		l := nextInt() - 1
		r := nextInt()
		fmt.Fprintln(w, MEMO[l][r])
	}
}

func solve(i, j int) {
	if j > N {
		return
	}
	MEMO[i][j] = MEMO[i][j-1] + count(S[j-2:j])
	solve(i, j+1)
	solve(i+1, j+1)
}

func count(s string) int {
	if s == "AC" {
		return 1
	} else {
		return 0
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var N, Q int
var S string
var MEMO [][]int

func main() {
	N = nextInt()
	Q = nextInt()
	S = nextString()
	MEMO = make([][]int, N)
	for i := 0; i < N; i++ {
		MEMO[i] = make([]int, N+1)
	}
	solve(0, 2)
	for i := 0; i < Q; i++ {
		l := nextInt() - 1
		r := nextInt()
		fmt.Println(MEMO[l][r])
	}
}

func solve(i, j int) {
	if j > N {
		return
	}
	MEMO[i][j] = MEMO[i][j-1] + count(S[j-2:j])
	solve(i, j+1)
	solve(i+1, j+1)
}

func count(s string) int {
	if s == "AC" {
		return 1
	} else {
		return 0
	}
}


N, Q = gets.split.map &:to_i
S = gets.chomp

b = Array.new(N+1, 0) # 累積和テーブル
N.times do |i|
  if i + 1 < N && S[i] == 'A' && S[i+1] == 'C'
    b[i+1] = b[i] + 1
  else
    b[i+1] = b[i]
  end
end

Q.times do
  l, r = gets.split.map { |i| i.to_i - 1 }
  puts b[r] - b[l]
end


#https://atcoder.jp/contests/abc122/submissions/14662859
#上のURLを参照にした。何回やっても時間制限かかるから。

#はじめから最後まで回す
#l,rまですべてのACの数をpushする。最後にlまでの合計からrまでの合計を引く。
n, q = gets.chomp.split(" ").map(&:to_i)
s = gets.chomp.split("")
s = s.unshift(" ")
arr = Array.new(n+1,0)
i = 2
ans = 0
while true
    if s[i] == "C" && s[i-1] == "A"
        arr[i] = ans + 1
    else
        arr[i] = ans
    end
    break if i == n
    ans = arr[i]
    i += 1
end
q.times do
    l, r = gets.chomp.split(" ").map(&:to_i)
    all = arr[r] - arr[l]
    puts all
end


N, Q = gets.chomp.split().map(&:to_i)
S = gets.chomp.split('')
AC_ind = Array.new(N+1, 0)

N.times do |i|
  if S[i] == 'A' && S[i+1] == 'C'
    AC_ind[i+1] = AC_ind[i] + 1
  else
    AC_ind[i+1] = AC_ind[i]
  end
end

Q.times do
  s, f = gets.chomp.split().map(&:to_i)
  puts AC_ind[f-1] - AC_ind[s-1]
end


n, q = gets.strip.split.map(&:to_i)
s = gets.strip
qs = q.times.map { gets.strip.split.map(&:to_i) }

len = s.chars.count()
counts = [0]
current = 0

(1..(len - 1)).each do |i|
  if s[i - 1] == 'A' && s[i] == 'C'
    current += 1
  end

  counts << current
end

qs.each do |l, r|
  puts(counts[r - 1] - counts[l - 1])
  puts(s[(l - 1)..(r - 1)])
end


N, Q = gets.split.map(&:to_i)
S = gets.chomp
lr = Q.times.map{|_| gets.split.map(&:to_i)}

cur = Hash.new()
m = Hash.new()
c = ""
S.chars.each.with_index(1) do |s, idx|
  p = 0
  if c == "A" && s == "C"
    p = 1
  end
  c = s
  idx.times do |i|
    i += 1
    if idx == i
      cur[i] = 0
      m[i] = {}
    else
      cur[i] += p
    end
    m[i][idx] = cur[i]
  end
end

lr.each do |l, r|
  p m[l][r]
end


/*------------------------------------------------------------------*/
/*------------------------- begin template -------------------------*/
/*------------------------------------------------------------------*/

// ref: tanakh <https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8>
// diff: using Parser
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut parser = Parser::from_str($s);
        input_inner!{parser, $($r)*}
    };
    (parser = $parser:ident, $($r:tt)*) => {
        input_inner!{$parser, $($r)*}
    };
    (new_stdin_parser = $parser:ident, $($r:tt)*) => {
        let stdin = std::io::stdin();
        let reader = std::io::BufReader::new(stdin.lock());
        let mut $parser = Parser::new(reader);
        input_inner!{$parser, $($r)*}
    };
    ($($r:tt)*) => {
        input!{new_stdin_parser = parser, $($r)*}
    };
}

macro_rules! input_inner {
    ($parser:ident) => {};
    ($parser:ident, ) => {};
    ($parser:ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($parser, $t);
        input_inner!{$parser $($r)*}
    };
}

macro_rules! read_value {
    ($parser:ident, ( $($t:tt),* )) => {
        ( $(read_value!($parser, $t)),* )
    };
    ($parser:ident, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($parser, $t)).collect::<Vec<_>>()
    };
    ($parser:ident, chars) => {
        read_value!($parser, String).chars().collect::<Vec<char>>()
    };
    ($parser:ident, usize1) => {
        read_value!($parser, usize) - 1
    };
    ($parser:ident, i64_) => {
        $parser.fast_i64()
    };
    ($parser:ident, usize_) => {
        $parser.fast_i64() as usize
    };
    ($parser:ident, usize1_) => {
        ($parser.fast_i64() - 1) as usize
    };
    ($parser:ident, $t:ty) => {
        $parser.next::<$t>().expect("Parse error")
    };
}

use std::io;
use std::io::BufRead;
use std::str;

// ref: tatsuya6502 <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e>
// ref: wariuni <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e#comment-7040a5ae96305e884eb9>
// diff: using std::io::BufRead::fill_buf()
pub struct Parser<R> {
    pub reader: R,
    buf: Vec<u8>,
    pos: usize,
}

impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}

impl<R: BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len, complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                (len, buf2[len - 1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T: str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return unsafe { str::from_utf8_unchecked(&self.buf[begin..end]) }.parse::<T>();
            } else {
                self.update_buf();
            }
        }
    }
    pub fn fast_i64(&mut self) -> i64 {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            if begin == self.buf.len() {
                self.update_buf();
                continue;
            }
            let mut res = 0;
            let (is_positive, mut end) = match self.buf[begin] {
                b'+' => (true, begin + 1),
                b'-' => (false, begin + 1),
                _ => (true, begin),
            };
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                res = res * 10 + (self.buf[end] as i64 - '0' as i64);
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return if is_positive { res } else { -res };
            } else {
                self.update_buf();
            }
        }
    }
}

#[allow(unused_imports)]
use std::cmp::*;

fn main() {
    input! {
        new_stdin_parser = parser,
    }
    let res = solve(&mut parser);
    print!("{}", res);
}

/*------------------------------------------------------------------*/
/*-------------------------- end template --------------------------*/
/*------------------------------------------------------------------*/

use std::fmt::Write;
fn solve<R: BufRead>(parser: &mut Parser<R>) -> String {
    let mut buf = String::new();
    input! {
        parser = parser,
        n: usize,
        m: usize,
        s: chars,
        qs: [(usize1, usize); m],
    }
    let mut right_ac_num = vec![0i64; n + 1];
    for i in (0..n - 1).rev() {
        right_ac_num[i] = right_ac_num[i + 1];
        if s[i] == 'A' && s[i + 1] == 'C' {
            right_ac_num[i] += 1;
        }
    }
    for &(l, r) in &qs {
        let res = right_ac_num[l] - right_ac_num[r - 1];
        writeln!(buf, "{}", res);
    }
    buf
}


#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    q: usize,
    s: chars,
    query: [(usize, usize); q],
  }
  let mut dp = vec![0; n + 1];
  let mut prev_a = false;
  for (i, &c) in s.iter().enumerate() {
    dp[i + 1] = dp[i];
    if c == 'C' && prev_a {
      dp[i + 1] += 1;
    }
    prev_a = c == 'A';
  }
  for &(l, r) in &query {
    puts!("{}\n", dp[r] - dp[l]);
  }
}


// Snippet
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => ({
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    })
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => (
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    )
}

// End Snippet

fn main() {
    println!("{}", solve(stdin!()));
}

fn solve(src: String) -> String {
    input!{
        source = src,
        n: usize, q: usize,
        s: chars,
        lr: [(usize, usize); q]
    }
    let mut ans = String::new();
    let mut counts = vec![0; n+1];

    for i in 1..n {
        counts[i] = counts[i-1] + if s[i-1] == 'A' && s[i] == 'C' {
            1
        } else {
            0
        }
    }

    for i in 0..q {
        let (l, r) = lr[i];
        let count = counts[r-1] - counts[l-1];
        ans.push_str(&count.to_string());
        ans.push_str("\n");
    }
    ans.to_string()
}

test! {
r"8 3
ACACTACG
3 7
2 3
1 8
"
=>
r"2
0
3
"
}


use proconio::marker::Chars;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        s: Chars,
        lr: [(usize, usize); q]
    };

    let s: Vec<char> = s;
    let mut v = vec![0; n - 1];
    let lr: Vec<(usize, usize)> = lr;

    let mut flag = false;
    let mut index = 0;

    for (i, si) in s.iter().enumerate() {
        if *si == 'A' {
            flag = true;
            index = i;
        } else if flag && *si == 'C' {
            flag = false;
            v[index] = 1;
        } else {
            flag = false;
        }
    }

    for lri in lr.iter() {
        let start = lri.0 - 1;
        let end = lri.1 - 1;

        let mut sum = 0;
        for i in start..end {
            sum += v[i];
        }

        println!("{}", sum);
    }
}


use proconio::input;
use proconio::marker::Usize1;

fn main() {
  input! {
    n: usize,
    q: usize,
    s: String,
    lrs: [(Usize1,Usize1);q],
  }
  let s = s.chars().collect::<Vec<char>>();
  let mut dp = vec![0;n];

  let mut last = s[0];
  for i in 1..n {
    let c = s[i];
    if last == 'A' && c == 'C' {
      last = 'C';
      dp[i] = dp[i-1] + 1;
    } else if last != 'A' && c == 'A' {
      last = 'A';
      dp[i] = dp[i-1];
    } else {
      dp[i] = dp[i-1];
    }
  }

  for (l, r) in lrs {
    println!("{}", dp[r] - dp[l]);
  }
}


fn solve() {
    let n: usize = read();
    let q: usize = read();
    let s: Vec<char> = read::<String>().chars().collect();
    let mut acc = vec![0, 0];
    let mut ac_count = 0;
    for i in 1..s.len() {
        if s[i - 1] == 'A' && s[i] == 'C' {
            ac_count += 1;
        }
        acc.push(ac_count);
    }
    println!("{:?}", acc);
    for i in 0..q {
        let (l, r): (usize, usize) = (read::<usize>(), read::<usize>());
        println!("{}", acc[r] - acc[l]);
    }
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Reverse};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let nq = readInts()
    let (n, q) = (nq[0], nq[1])
    let s = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var count = 0
    var aryACIndex = [Int](repeating: 0, count: n)
    for i in 1..<n {
        if s[i - 1] == "A" && s[i] == "C" {
            count += 1
        }
        aryACIndex[i] = count
    }

    for _ in 1...q {
        let lr = readInts()
        let (l, r) = (lr[0] - 1, lr[1] - 1)

        print(aryACIndex[r] - aryACIndex[l])
    }
}
main()


let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (N, Q) = (input[0], input[1])
let S = (readLine()!+"_").characters.map{String($0)}
var t = Array(count: N+1, repeatedValue: 0)
for i in 0..<N {
  	t[i+1] = t[i] + (S[i] + S[i+1] == "AC" ? 1 : 0)
}
for _ in 0..<Q {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    let (l, r) = (input[0], input[1])
    print(t[r-1] - t[l-1])
}


import Foundation

extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
}

let input = readLine()!.split(by: " ").map{Int($0)!}
let N = input[0]
let Q = input[1]
let S = (readLine()!+"_").characters.map{$0}

var sum = [0]
for i in 1...N {
    sum.append(sum[i-1])
    if (S[i-1] == "A") && (S[i] == "C") {
        sum[i] += 1
    }
}

for _ in 0..<Q {
    let input = readLine()!.split(by: " ").map{Int($0)!}
    print(sum[input[1]-1] - sum[input[0]-1])
}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let nq = readInts()
    let (n, q) = (nq[0], nq[1])
    let s = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var aryACIndex = [Int]()
    for i in 1..<n {
        if s[i - 1] == "A" && s[i] == "C" {
            aryACIndex.append(i)
        }
    }

    for _ in 1...q {
        let lr = readInts()
        let (l, r) = (lr[0], lr[1])
        var ans = 0
        for i in 0..<aryACIndex.count {
            if aryACIndex[i] >= l && aryACIndex[i] < r {
                ans += 1
            }
            if aryACIndex[i] >= r {
                break
            }
        }
        print(ans)
    }
}
main()


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let nq = readInts()
    let (n, q) = (nq[0], nq[1])
    let s = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var aryACIndex = [Int]()
    for i in 1..<n {
        if s[i - 1] == "A" && s[i] == "C" {
            aryACIndex.append(i)
        }
    }

    for _ in 1...q {
        let lr = readInts()
        let (l, r) = (lr[0] - 1, lr[1] - 1)
        var ans = 0
        for i in 0..<r {
            if aryACIndex[i] >= l && aryACIndex[i] <= r {
                ans += 1
            }
        }
        print(ans)
    }
}
main()


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let nq = readInts()
    let (n, q) = (nq[0], nq[1])
    var s = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var aryACIndex = [Int]()
    for i in 1..<n {
        if s[i - 1] == "A" && s[i] == "C" {
            aryACIndex.append(i)
        }
    }

    for _ in 1...q {
        let lr = readInts()
        let (l, r) = (lr[0] - 1, lr[1] - 1)
        var ans = 0
        for i in 0..<r {
            if aryACIndex[i] >= l && aryACIndex[i] <= r {
                ans += 1
            }
        }
        print(ans)
    }
}
main()


export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const [n, q]: number[] = tmp[0].split(" ").map(Number);
    const s: string = tmp[1];
    const acCountList: number[] = [];
    let prevA: boolean = false;
    let count: number = 0;
    for (let i = 0; i < n; i++) {
      const t: string = s.charAt(i);
      if (t == "A") {
        prevA = true;
      } else if (prevA) {
        if (t == "C") {
          ++count;
        }
        prevA = false;
      }
      acCountList.push(count);
    }
    const result: number[] = []
    for (let i = 2, len = q + 2; i < len; i++) {
      const [l, r]: number[] = tmp[i].split(" ").map(Number);
      result.push(acCountList[r - 1] - acCountList[l - 1]);
    }
    return `${result.join("\n")}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


const input = require("fs").readFileSync("/dev/stdin", "utf8").trim();

const lines = input.split('\n');
const [_, text, ...indexes] = lines;

const acMap = new Array(text.length);
let count = 0, prev = '', char = '', i = 0;
for (; i < text.length; i++) {
    if (text[i-1] === 'A' && text[i] === 'C') {
        count++;
    }
    acMap[i] = count;
}

const results = indexes.map((line) => {
    const [i, j] = line.split(' ').map(Number);
    return acMap[j - 1] - acMap[i - 1];
});

console.log(results.join('\n'));


function main(input) {
  input = input.trim().split("\n");
  const [n, q] = input[0].split(" ").map(n => Number(n));
  const s = input[1];
  const lr = input.slice(2).map(n => n.split(" ").map(m => Number(m));
  const arr = [s[0] === "A" && s[1] === "C" ? 1 : 0];
  for (let i = 1; i < s.length; i++) {
    const char = s[i];
    if (char === "A" && s[i+1] === "C") {
      arr.push(arr[i-1] + 1);
    } else {
      arr.push(arr[i-1]);
    }
  }
  const result = [];
  for (let i = 0; i < q; i++) {
    const [l, r] = lr[i];
    if (l === 1) {
      result.push(arr[r-2]);
    } else {
      result.push(arr[r-2]-arr[l-2]);
    }
  }
  console.log(result.join("\n"));
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};const isPrime=(n:number):boolean=>{if(n<2)return false;const suq=Math.sqrt(n);for(let i=2;i<=suq;i++){if(n%i==0){return false;}}return true;};
const main=()=>{
  let [n,m]=tnn(2),s=ts()
  for(let i=0;i<m;i++){
    let ns=s.substring(tn()-1,tn()),next='A',c=0
    for(let j=0;j<ns.length;j++){
        if(ns[j]==next&&next=='A')next='C'
        else if(ns[j]==next){
            next='A'
            c++
        }
    }
    to(c)
  }
}
main()


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};const isPrime=(n:number):boolean=>{if(n<2)return false;const suq=Math.sqrt(n);for(let i=2;i<=suq;i++){if(n%i==0){return false;}}return true;};
const main=()=>{
  let [n,m]=tnn(2),s=ts()
  for(let i=0;i<m;i++){
      let ns=s.substring(tn()-1,tn()-1);
      to(ns)
  }
}
main()


function Main(input) {

  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var Q = parseInt(input[0].split(" ")[1]);
  var S = input[1];

  var l = Array(input.length-2);
  var r = Array(input.length-2);

  for(var i = 2; i < input.length; i ++){
    l[i-2] = parseInt(input[i].split(" ")[0]);
    r[i-2] = parseInt(input[i].split(" ")[1]);
  }

  var AtCoder = function(){
    this.dp = Array(N+1).fill(0);
  };

  AtCoder.prototype = {
    procedure: function(){
      for(let i = 0; i < N; i++){
        this.dp[i] = S.substring(0,i).split("AC").length -1;
      }
      this.dp[N] = this.dp[N-1];
      for(let i = 0; i < Q; i++){
        console.log(this.dp[r[i]]-this.dp[l[i]]);
      }
      return;
    }
  }
  var atcoder = new AtCoder();
  atcoder.procedure();
}

var input=require("fs").readFileSync("/dev/stdin", "utf8");
// var input=`8 3
// ACACTACG
// 3 7
// 2 3
// 1 8`
Main(input);


n = int(input())
s = "0 0 0 0 0 1 0 0 0 0 3 0 0 0 0 0 3 3 0 0 0 0 0 1 6 0 3 0 0 0 0 0 3 3 6 0 0 3 0 0 0 0 3 3 6 0 6 0 0 0 3 0 0 1 6 0 6 6 0 0 6 0 0 0 0 3 3 3 6 0 6 3 6 0 0 0 6 0 0 0 3 3 9 0 6 3 6 0 3 6 0 0 0 0 6 1 6 0 6 6 0 3 12 0 6 0 0 3 6 0 0 0 3 3 12 0 6 3 6 0 3 6 9 0 6 0 0 0 3 6 3 3 6 0 6 3 12 0 3 6 6 0 6 0 6 3 6 0 0 1 6 3 12 6 0 0 12 0 6 0 6 6 12 0 0 6 0 0 6 0 12 3 6 0 6 3 9 6 3 6 6 0 6 0 6 0 15 6 0 0 6 0 3 3 12 0 12 6 6 0 3 6 6 3 12 0 6 0 9 6 0 0 6 3 12 1 6 6 6 6 0 0 18 0 12 0 3 6 12 0 0 6 3 6 12 0 12 0 0 0 9 3 9 6 12 3 12 0 3 6 6 0 12 0 12 0 9 9 0 0 6 3 6 3 12 6 9 3 6 0 12 3 6 3 9 6 12 6 6 0 6 0 9 6 6 0 12 3 6 0 9 6 6 1 6 0 21 12 6 0 12 0 12 0 0 6 15 6 0 6 12 0 12 0 12 0 0 0 12 0 12 12 3 3 18 3 6 3 6 6 9 9 18 0 6 0 12 0 9 6 0 3 12 3 6 6 12 6 6 0 0 0 15 3 18 3 18 3 12 6 3 6 9 0 12 0 12 0 18 12 0 0 12 3 6 0 6 6 9 6 0 0 18 1 18 3 12 6 6 6 12 0 15 6 12 6 18 0 0 6 0 9 12 0 18 0 6 3 12 0 12 12 0 0 12 0 3 6 12 6 18 9 18 0 9 6 18 0 6 0 6 3 27 6 6 6 6 3 6 0 12 6 9 0 6 0 18 0 9 9 15 3 12 6 6 3 9 6 12 12 18 0 18 0 6 6 21 6 0 0 6 3 15 6 12 6 18 0 0 0 12 6 6 3 6 4 18 6 12 6 3 9 30 0 18 0 6 6 12 6 6 9 12 0 18 6 18 0 6 0 12 0 6 12 6 3 18 0 6 6 6 6 15 3 24 0 6 3 18 0 12 6 12 6 24 0 15 18 9 6 0 0 18 3 6 0 15 12 12 6 6 0 18 0 6 3 12 0 12 6 6 9 9 6 24 3 24 0 9 12 6 6 12 0 12 0 21 9 15 6 12 3 18 3 12 6 12 6 0 0 12 0 12 6 24 0 6 12 6 1 9 6 12 6 24 0 18 3 12 6 6 12 24 0 12 6 15 6 18 0 18 0 0 0 18 9 21 12 0 6 18 0 9 6 6 6 12 0 12 0 9 9 27 6 6 3 18 6 21 6 6 12 12 0 12 0 24 12 0 0 24 3 24 6 12 12 18 0 0 0 12 0 18 3 15 6 12 9 6 0 15 6 9 12 24 0 12 3 6 6 21 6 18 3 18 0 21 12 15 6 6 0 12 3 12 9 18 9 12 6 6 6 24 0 18 3 24 0 6 6 0 6 9 6 6 4 30 0 18 12 9 6 24 0 18 0 9 12 21 6 6 12 12 0 18 0 21 15 12 0 12 6 12 12 18 0 18 0 6 0 9 12 18 6 30 0 0 0 24 6 9 3 12 6 30 3 6 12 6 12 12 0 36 0 6 3 27 12 12 6 6 6 24 0 12 6 12 0 18 0 18 15 18 3 18 6 12 6 6 12 3 6 6 0 12 3 39 3 12 12 12 3 18 0 21 12 21 6 18 0 12 0 9 9 12 9 24 9 12 6 12 6 33 0 6 0 18 0 9 15 12 6 24 6 6 3 15 6 15 12 18 0 18 1 18 6 12 6 6 0 24 6 24 12 18 6 24 0 6 6 12 15 24 0 24 6 6 0 18 0 15 18 12 0 24 0 12 6 12 12 18 6 24 0 0 6 24 3 12 0 12 6 30 9 6 12 24 12 12 0 15 18 12 0 18 0 24 6 15 6 18 3 18 3 12 6 24 12 12 12 6 0 36 0 18 3 6 12 6 9 12 0 3 12 36 0 30 0 12 0 18 6 12 9 12 6 24 3 18 12 15 9 24 0 18 6 18 9 18 12 6 6 24 3 24 0 12 12 12 0 6 0 27 12 18 3 30 3 18 6 0 12 15 6 18 0 24 0 9 6 9 12 18 7 24 0 24 12 15 12 24 0 24 0 6 9 30 9 6 6 0 9 33 12 36 0 12 0 18 0 6 21 12 6 36 6 0 3 18 6 12 6 24 0 12 3 24 6 9 12 6 6 30 6 18 12 9 9 12 0 30 3 18 3 27 6 30 12 12 0 24 0 27 12 6 0 24 3 18 18 9 6 18 0 12 3 33 18 12 9 6 0 12 6 30 0 24 12 12 0 30 6 6 6 0 6 24 0 12 0 18 15 33 6 30 15 18 0 9 12 24 9 12 0 18 6 27 18 15 6 18 3 24 0 6 6 36 12 18 0 12 3 30 3 12 6 12 15 6 0 18 12 15 9 30 0 18 6 12 12 18 6 6 3 24 1 27 12 18 6 18 0 24 0 18 15 15 21 30 6 12 12 18 0 30 6 24 0 6 0 18 6 36 12 6 6 36 0 6 12 12 12 24 0 30 0 9 6 18 0 18 12 12 6 24 6 9 15 12 0 12 6 30 9 18 0 42 3 18 6 12 18 33 12 12 0 18 0 21 12 12 12 24 6 30 0 27 18 6 12 6 0 24 0 18 15 30 0 18 12 6 0 21 6 21 12 24 0 30 0 6 6 6 12 24 0 30 12 9 12 21 3 24 0 12 3 21 18 9 18 18 6 30 3 42 6 21 6 30 0 6 3 24 9 36 6 6 9 12 6 18 12 33 9 12 0 24 9 9 6 3 18 36 6 18 0 24 6 6 6 18 0 12 0 30 3 39 12 12 7 18 0 15 18 18 9 36 0 24 6 6 18 30 0 18 9 18 3 24 6 21 12 24 0 30 3 33 24 12 6 18 6 6 6 18 6 18 12 18 0 24 6 36 3 18 6 0 12 30 0 9 24 18 0 24 0 18 0 0 12 30 15 30 6 18 3 30 0 24 18 12 0 36 3 24 12 15 18 18 6 24 3 24 12 18 12 24 0 0 6 39 6 24 3 18 3 42 6 12 12 15 9 30 0 12 0 18 6 18 12 24 15 12 0 12 12 30 12 12 0 18 0 15 15 18 18 30 3 24 12 9 6 48 0 18 0 30 0 21 6 12 12 24 12 18 3 48 24 6 6 18 0 36 0 12 15 27 6 12 12 18 6 27 6 12 9 18 0 24 6 18 18 21 0 36 0 12 0 18 12 21 18 24 0 12 1 18 9 21 18 6 9 42 3 36 12 12 12 30 0 12 6 21 12 36 6 24 9 12 6 12 12 24 12 18 0 42 0 15 6 15 15 42 6 30 6 12 12 18 12 18 0 6 6 36 0 30 18 6 0 6 0 30 18 18 0 42 0 18 6 15 18 24 0 12 6 36 9 33 12 12 12 18 0 36 0 21 21 15 18 18 15 18 0 18 6 42 6 24 0 18 3 42 6 18 12 12 12 18 0 15 12 18 12 36 0 30 12 3 21 18 0 30 6 24 0 27 12 18 12 6 0 12 0 36 15 15 3 36 12 18 6 30 6 33 12 12 0 12 6 24 6 54 18 12 3 36 9 9 12 12 18 36 0 6 0 21 15 27 9 24 12 30 6 24 6 27 18 12 0 30 0 21 12 18 6 30 0 18 0 21 18 21 6 30 0 24 3 6 6 15 27 12 10 42 6 36 12 12 6 24 0 24 6 12 12 48 6 18 12 0 3 51 6 30 6 24 0 24 0 30 21 15 12 24 9 18 6 18 12 30 9 24 0 18 0 27 18 9 6 18 9 54 0 18 24 21 18 12 0 24 0 12 0 30 9 30 12 6 9 24 6 15 15 18 0 30 3 33 18 21 12 42 3 30 6 6 24 27 6 12 0 24 3 42 6 42 9 12 6 18 6 24 12 12 12 54 0 6 12 18 6 18 18 30 12 30 0 18 0 27 18 24 0 18 0 15 24 21 6 24 3 36 6 6 6 45 21 18 0 18 6 33 3 18 0 24 15 30 0 30 24 12 6 36 0 24 3 21 24 18 15 30 3 12 6 42 12 12 12 6 0 54 6 30 15 24 18 24 6 12 0 9 6 30 0 48 0 24 0 15 12 39 12 24 6 24 6 15 30 12 6 24 0 24 3 24 12 24 6 6 18 12 4 54 6 21 18 18 0 36 6 24 9 30 12 24 9 36 6 12 18 42 3 30 0 6 9 21 6 12 30 30 6 30 0 27 12 9 18 30 0 36 0 18 9 42 6 24 12 0 6 51 12 24 12 12 0 18 6 12 18 6 6 36 3 54 9 18 6 27 12 18 0 30 0 39 9 18 18 12 9 30 6 21 12 27 18 24 0 12 0 42 18 42 6 24 15 18 0 24 12 45 12 6 0 54 0 15 21 6 6 30 6 18 12 24 18 30 6 36 0 12 3 24 12 18 18 18 12 24 0 33 12 27 6 42 0 18 6 9 15 30 6 30 6 12 6 18 6 33 15 30 0 36 3 27 21 33 24 30 9 24 0 12 18 33 6 6 0 18 3 57 12 24 18 30 9 18 0 18 12 27 12 36 0 36 6 12 6 27 12 30 9 24 6 39 18 12 24 12 0 30 0 30 6 15 15 18 3 24 18 9 12 30 9 30 0 18 6 42 18 30 0 6 10 48 0 24 12 12 18 48 0 30 3 30 15 18 6 24 18 18 0 42 6 36 15 24 0 42 12 21 24 12 12 24 0 12 6 18 18 60 6 30 0 12 0 24 0 12 18 30 15 42 0 33 30 6 6 12 0 42 3 27 6 33 12 36 12 18 0 30 6 18 12 12 0 18 6 15 27 27 6 42 6 36 9 18 30 33 9 30 0 6 6 54 6 36 24 24 0 30 3 12 6 21 24 30 0 24 0 24 12 42 9 42 21 12 12 27 12 27 6 12 0 48 6 12 18 12 12 36 6 30 0 24 0 42 12 12 0 36 0 24 15 21 21 18 6 12 9 36 18 18 15 42 0 18 6 9 18 48 12 30 9 24 3 33 6 18 18 18 0 36 3 54 24 3 12 36 9 36 6 30 12 36 12 24 0 18 6 24 6 42 0 24 18 18 0 9 30 39 12 42 0 36 0 12 12 21 12 18 12 24 6 45 6 18 24 18 0 36 0 42 15 18 6 24 6 12 12 18 12 30 6 18 0 30 1 30 9 57 9 12 9 48 6 21 24 18 12 66 0 18 6 9 24 24 24 30 12 18 0 48 6 24 18 18 0 24 3 27 18 24 12 36 6 48 6 15 18 42 6 24 0 12 12 36 6 6 24 12 3 48 0 48 18 0 12 18 0 36 6 18 9 54 15 12 12 6 6 39 6 24 18 42 0 30 0 33 18 24 18 18 9 18 0 15 18 54 0 36 0 24 0 48 24 15 18 18 12 42 9 24 12 36 21 30 0 36 12 24 3 30 0 48 15 12 6 15 18 18 18 24 0 30 0 24 24 18 9 72 0 30 6 21 18 30 6 24 0 0 6 24 18 42 12 6 15 36 0 30 18 30 12 24 0 6 0 18 12 54 9 36 9 36 9 30 6 27 27 24 0 54 6 21 18 21 6 36 15 36 3 30 12 6 18 30 0 18 6 54 0 30 21 36 9 30 6 30 24 24 6 30 0 36 12 9 24 24 12 18 9 30 0 48 12 24 12 12 0 48 0 18 12 24 24 30 6 18 12 21 12 24 0 66 0 12 0 30 9 24 24 18 13 42 3 18 18 27 24 24 0 30 6 15 18 39 12 12 9 36 12 54 12 42 18 6 0 36 0 51 18 12 0 66 12 24 0 6 24 51 12 24 0 24 0 33 6 18 18 30 6 42 3 18 30 15 15 30 0 30 6 30 12 48 12 24 12 12 9 36 6 36 6 12 0 30 0 24 21 24 15 42 12 24 6 9 18 15 9 42 0 24 12 66 12 30 24 6 9 54 0 36 12 21 12 36 0 24 3 24 15 36 6 30 24 12 6 33 6 39 21 30 0 42 6 12 30 30 18 36 0 48 3 36 12 30 18 18 0 24 0 30 6 33 21 24 6 18 12 24 12 12 15 48 0 24 6 21 21 60 6 24 12 18 0 30 12 15 12 24 0 24 3 60 27 18 12 30 3 24 9 21 12 60 18 24 0 24 9 33 6 36 12 24 15 42 6 27 36 27 6 42 0 42 6 12 15 15 24 42 18 12 0 33 6 21 18 24 0 48 3 36 9 24 24 30 6 36 0 39 18 60 6 18 0 12 6 21 27 30 0 18 6 42 6 42 18 24 9 48 0 6 6 18 18 18 6 18 15 30 4 60 12 30 30 18 0 36 0 27 18 30 18 48 9 30 12 18 6 42 9 48 0 18 6 42 6 30 24 12 3 36 0 36 36 15 18 30 0 66 0 12 18 42 9 24 15 18 12 54 6 18 21 36 0 30 6 24 24 12 6 24 9 36 12 6 12 45 12 36 0 36 0 48 3 24 18 12 24 36 0 30 12 30 21 30 0 6 15 18 15 66 12 42 3 12 0 39 12 30 12 18 0 54 6 30 24 9 12 60 12 30 12 30 24 24 18 30 0 36 0 27 9 45 18 24 12 24 0 36 24 12 6 60 0 18 0 24 15 51 9 24 12 30 12 27 18 51 18 24 0 36 6 27 27 12 30 36 6 30 0 12 6 42 0 18 0 18 0 48 12 45 24 6 15 42 6 12 18 27 9 54 0 42 3 33 12 15 12 54 18 30 6 36 18 21 30 18 0 48 3 30 18 36 6 18 0 18 12 57 24 42 6 24 0 18 12 36 18 30 12 36 3 78 0 24 6 6 36 42 0 24 0 21 15 33 6 42 18 12 3 30 12 30 27 24 0 42 12 39 12 30 12 30 15 30 6 12 24 54 6 24 0 18 6 33 12 18 24 24 7 30 0 60 24 21 12 30 0 48 6 18 15 39 12 18 18 18 0 48 12 54 18 42 0 30 0 15 30 27 18 72 0 30 15 12 12 30 18 36 0 6 3 60 15 24 18 6 18 54 6 21 24 24 12 30 0 30 6 30 15 54 6 48 12 30 12 36 0 24 3 24 0 54 6 18 30 15 6 42 9 36 0 21 30 15 12 12 0 24 3 72 0 51 39 24 12 30 3 33 18 15 12 42 0 30 12 27 24 51 12 42 12 18 3 42 12 39 18 12 0 30 0 24 21 21 21 30 6 66 12 12 6 69 21 30 0 24 6 45 12 12 18 42 12 18 0 39 30 33 12 54 0 12 0 12 18 36 9 30 9 24 9 60 12 30 12 12 0 42 9 42 18 45 24 42 6 12 9 24 6 30 12 42 0 30 6 15 15 30 12 18 12 54 6 21 30 12 33 60 0 48 0 30 15 42 6 24 24 30 0 36 18 33 18 12 0 60 0 72 15 12 9 30 12 24 15 21 24 51 12 24 0 24 6 12 6 33 24 36 9 54 6 27 24 30 6 48 0 24 3 36 27 42 15 18 18 12 6 54 6 30 15 36 0 12 12 18 24 21 18 30 3 60 0 33 12 36 18 48 0 24 1 39 12 24 18 24 9 66 6 48 24 12 12 42 0 24 6 18 12 63 6 36 24 18 0 39 12 39 24 24 0 54 6 15 24 15 24 48 3 36 12 12 24 39 18 36 0 42 6 42 6 60 24 12 18 18 0 45 6 6 6 72 0 30 6 24 9 36 12 24 9 30 15 36 18 33 24 6 0 54 0 33 36 18 24 36 6 18 6 24 18 75 6 18 0 18 0 48 9 36 18 42 9 30 0 27 36 24 15 42 0 42 18 36 12 18 12 72 9 24 0 54 18 21 24 12 0 60 0 24 24 39 12 42 18 30 6 9 12 48 12 30 0 18 12 36 15 48 18 18 3 42 6 42 18 18 24 54 0 36 0 24 36 42 0 12 27 30 6 60 6 30 24 12 0 36 3 42 12 18 12 36 9 30 0 15 18 33 12 54 0 30 6 33 21 27 30 42 12 54 9 42 24 27 6 36 0 24 12 24 12 45 24 12 6 30 12 69 12 42 12 30 0 24 0 42 18 24 15 60 9 48 18 18 24 27 12 36 0 30 0 54 9 30 18 24 15 48 0 24 24 45 24 24 0 18 6 36 9 54 15 24 12 12 6 18 12 54 18 12 0 60 3 48 30 12 18 60 6 24 3 36 12 33 12 36 0 36 6 36 3 33 24 12 13 42 12 27 18 30 12 54 0 30 12 21 39 54 6 54 18 18 0 33 12 36 36 36 0 30 0 42 33 18 18 36 12 30 3 30 12 66 6 30 0 18 12 63 18 24 6 30 12 48 9 6 24 30 12 42 0 72 0 30 12 48 3 24 15 12 12 66 18 9 36 12 0 54 0 54 18 15 30 36 6 12 0 21 18 54 12 30 0 6 0 36 15 60 18 18 15 48 6 27 24 21 12 54 0 54 9 12 24 48 12 48 15 54 6 36 6 39 24 24 0 24 3 33 24 18 18 66 12 18 12 30 12 75 15 36 0 30 9 24 6 21 24 24 12 60 0 66 36 12 18 36 0 24 6 30 18 39 18 30 12 24 9 30 6 36 18 18 0 54 12 33 24 36 6 66 0 30 6 12 12 33 24 54 0 18 3 60 3 30 24 24 21 48 0 18 30 51 12 18 0 30 12 33 15 18 12 30 27 24 0 48 12 45 6 30 0 72 0 51 18 27 27 54 9 48 12 27 30 36 18 18 0 42 3 36 9 45 30 6 6 36 3 51 24 24 18 72 0 18 6 9 36 42 0 36 9 30 12 60 30 24 15 24 0 36 6 30 27 27 18 42 12 48 0 42 0 33 24 24 0 30 0 42 12 48 9 36 9 24 6 27 36 12 9 60 0 30 12 15 18 42 18 36 18 24 7 48 12 54 24 30 0 78 0 18 18 27 24 24 6 30 12 33 18 60 15 54 0 12 12 36 12 36 24 30 18 54 0 18 18 18 24 84 0 54 0 27 15 42 6 36 12 18 9 54 6 30 30 24 0 30 9 60 30 36 6 42 12 30 6 6 30 60 0 18 0 24 9 51 18 24 33 30 0 42 12 60 18 18 36 18 0 24 0 18 9 78 12 48 24 12 0 48 6 12 18 42 0 48 0 30 27 18 6 48 3 66 21 18 18 33 12 48 0 30 6 63 21 18 36 24 15 60 6 36 30 36 0 48 0 48 3 36 30 42 18 24 24 12 6 21 6 72 12 36 0 60 6 12 18 15 24 60 9 30 0 39 30 54 12 18 0 18 3 60 9 57 24 6 18 48 6 60 18 18 9 48 0 24 12 18 18 39 6 42 15 36 6 36 18 18 30 18 0 42 6 39 27 27 18 48 12 42 12 24 18 27 9 30 0 24 9 81 12 72 12 30 6 36 0 33 42 39 30 42 0 12 3 12 6 24 18 48 12 48 3 63 24 24 27 30 0 78 6 36 18 36 30 30 12 36 12 30 6 60 12 48 0 24 0 36 21 30 24 30 12 48 0 36 12 24 27 36 0 42 12 27 24 54 6 18 12 48 0 30 6 72 24 12 0 30 3 45 24 0 18 78 15 18 18 39 18 39 9 36 0 24 6 39 12 30 18 30 16 48 0 36 30 12 12 60 0 42 3 24 21 84 33 30 12 18 18 48 12 36 12 30 0 48 9 42 36 42 6 48 3 42 0 33 24 30 12 36 0 36 6 54 12 30 30 6 21 66 0 39 24 36 24 36 0 24 12 30 15 54 12 78 30 6 0 33 12 27 30 30 0 36 6 18 36 36 6 66 3 60 6 18 30 42 0 12 0 36 6 54 6 33 24 24 12 54 0 42 12 15 12 60 0 30 0 21 18 75 18 48 18 18 15 30 24 42 33 36 0 30 6 45 24 9 30 36 3 54 15 24 18 63 18 42 0 24 0 75 6 30 9 30 15 42 12 33 36 21 24 60 0 54 9 30 30 48 12 18 12 24 0 66 12 24 18 36 0 72 6 36 15 27 27 30 6 12 18 24 6 78 15 42 0 12 6 27 24 51 18 36 12 60 3 51 30 12 24 36 0 30 0 48 12 21 6 36 24 54 6 42 6 36 36 6 0 54 12 27 15 18 18 66 6 42 0 15 30 63 12 48 0 36 3 63 12 36 30 18 9 48 3 48 36 30 12 42 0 72 6 36 30 30 12 24 12 6 15 75 18 30 6 36 0 24 0 18 36 48 18 60 18 60 12 33 12 33 15 72 0 18 9 54 15 21 30 36 12 30 0 42 24 48 18 36 0 24 6 18 15 81 12 12 27 36 12 30 6 36 18 24 0 48 6 36 36 27 6 48 9 36 3 36 36 36 24 30 0 24 1 42 6 66 27 24 18 48 12 51 18 24 18 84 0 24 6 12 9 63 18 48 9 30 0 36 12 33 24 30 0 72 0 42 48 36 18 42 12 42 15 24 12 60 15 24 0 12 21 72 3 42 30 24 18 36 6 42 18 30 12 42 0 48 12 12 24 24 18 66 6 24 0 93 12 51 30 12 0 54 6 18 27 24 24 36 12 30 0 45 18 60 6 54 0 24 0 51 24 21 18 30 6 72 6 6 18 21 36 42 0 48 12 27 24 36 6 30 27 30 6 39 18 51 36 30 0 42 0 66 18 36 6 66 9 24 12 24 24 78 12 36 0 36 12 60 15 42 24 6 15 54 0 33 30 21 30 42 0 54 0 24 9 60 9 36 24 24 6 66 12 48 18 54 0 30 0 30 39 30 18 48 6 42 12 33 24 33 12 60 0 18 6 42 24 42 24 6 12 72 6 42 30 18 9 30 0 24 15 30 18 60 12 54 15 24 0 48 24 33 12 36 0 66 6 36 18 21 30 72 3 24 9 27 30 30 18 42 0 42 0 72 6 39 42 24 18 60 3 24 18 36 18 30 0 54 6 27 33 60 12 24 24 18 18 30 12 21 33 48 0 78 12 78 12 30 12 42 12 48 0 24 12 75 18 24 0 18 0 33 24 30 21 42 15 30 12 39 30 51 12 54 0 36 12 18 12 48 24 78 18 18 6 78 6 24 30 12 0 42 0 45 18 15 27 42 0 54 18 36 18 36 6 48 0 30 12 36 21 45 6 24 7 54 0 27 42 33 24 72 0 42 0 48 24 45 18 18 15 36 15 66 6 66 30 18 0 48 0 27 39 30 18 66 27 12 12 18 24 60 6 66 0 42 0 42 6 33 21 36 12 42 6 21 36 33 21 48 0 66 12 6 18 75 24 36 12 18 0 81 12 42 30 36 0 24 0 30 30 30 6 60 9 60 6 24 30 30 6 30 0 30 12 75 18 30 24 24 15 78 0 42 24 18 30 42 0 30 12 21 12 48 9 60 21 30 12 24 24 39 21 24 0 54 3 39 30 33 24 72 12 60 0 18 24 57 12 24 0 24 3 90 9 12 21 36 12 30 18 84 24 30 9 60 0 36 18 18 24 78 18 24 18 48 6 24 0 45 30 24 0 66 3 60 36 21 42 42 6 30 6 33 12 60 21 36 0 6 6 36 15 36 30 48 21 48 0 39 36 36 6 54 0 66 3 18 18 33 24 36 18 30 9 66 6 15 36 24 0 96 6 30 12 42 6 36 6 36 9 27 36 42 12 42 0 18 6 51 12 78 18 30 9 54 12 39 24 24 33 66 0 36 9 45 33 36 12 18 27 36 0 78 12 48 24 30 0 42 9 48 21 18 9 60 12 54 6 21 24 72 3 66 0 18 18 33 12 21 36 36 6 36 6 60 36 36 18 48 0 24 0 30 24 87 24 24 27 42 6 60 18 66 6 18 0 36 6 39 36 30 18 36 9 30 0 18 18 51 12 48 0 54 0 48 18 36 30 36 30 66 3 12 18 15 39 60 0 24 12 66 6 54 12 48 6 18 7 30 24 48 18 30 0 84 0 30 48 12 15 60 9 42 18 42 18 42 18 48 0 30 9 48 21 69 36 12 12 48 0 57 18 24 24 66 0 36 6 24 21 69 6 54 12 30 18 72 18 30 30 18 0 42 0 42 42 12 18 42 6 54 9 42 12 72 18 24 0 24 3 78 0 24 24 30 15 60 6 42 30 39 21 36 0 54 12 27 24 42 24 72 21 30 0 48 18 24 30 12 0 30 3 24 15 72 33 42 6 24 24 12 24 66 12 60 0 24 6 63 12 42 18 24 18 84 6 30 24 24 6 90 0 72 6 21 24 30 18 18 30 24 6 66 18 54 18 36 0 36 12 60 27 30 18 90 18 18 0 18 24 48 24 30 0 36 6 36 18 66 36 30 3 66 3 57 48 12 18 36 0 48 6 36 21 48 0 60 12 36 12 72 0 36 30 30 0 48 0 33 30 48 9 54 9 36 24 18 30 42 18 54 0 12 0 54 12 21 24 30 21 72 0 66 24 27 18 36 0 24 0 45 24 78 0 42 21 24 12 39 30 54 30 24 0 84 15 24 24 9 30 54 9 48 6 33 18 57 18 30 0 60 3 54 27 33 30 36 24 42 0 54 18 39 24 54 0 60 18 24 15 75 12 24 12 42 0 39 12 36 36 36 0 30 3 66 42 15 24 72 12 48 12 42 12 48 15 24 0 18 18 60 6 60 18 36 9 24 6 27 36 30 24 90 0 60 3 21 18 54 24 48 18 18 12 51 24 39 18 18 0 72 12 42 21 36 24 36 6 36 0 33 18 42 0 60 0 18 6 42 21 39 39 36 13 84 6 24 18 30 24 78 0 36 3 54 39 51 18 30 21 24 3 60 12 87 42 30 0 36 6 30 15 36 12 54 18 42 12 27 24 84 15 42 0 18 9 54 18 30 30 48 12 72 0 54 42 9 12 36 0 60 0 27 21 78 18 42 30 30 6 54 6 30 18 24 0 60 12 42 36 48 24 54 6 36 15 12 48 21 12 30 0 36 0 102 6 18 12 24 9 60 12 48 24 33 30 66 0 30 12 30 15 60 12 54 36 30 0 36 6 72 18 36 0 54 0 30 36 9 15 60 0 60 15 39 12 63 18 42 0 30 18 60 21 57 30 0 18 54 3 75 30 48 24 42 0 24 12 36 42 57 9 48 9 36 6 45 12 24 48 54 0 66 0 45 33 30 18 54 18 36 0 36 6 54 30 54 0 36 0 66 12 42 21 24 18 48 6 21 48 42 12 60 0 84 12 0 12 54 24 36 18 18 12 81 18 33 18 12 0 66 3 66 6 33 48 48 6 24 24 36 18 60 6 36 0 24 6 39 21 42 18 42 12 60 0 24 30 33 36 72 0 30 0 36 36 42 12 36 15 24 15 75 30 63 27 24 0 42 6 63 30 18 12 108 9 48 12 24 12 72 18 30 0 54 6 30 9 63 27 48 15 36 6 48 36 18 12 54 0 42 9 36 36 63 18 36 24 36 0 75 6 63 24 36 0 48 6 27 39 30 18 30 9 54 18 36 18 39 21 66 0 30 0 54 18 42 36 12 24 108 0 30 24 42 12 48 0 24 0 15 9 48 18 66 24 24 12 54 12 36 21 54 0 54 18 45 42 36 24 42 3 36 0 42 48 42 12 36 0 36 1 60 18 36 18 36 15 54 9 60 30 24 21 48 0 24 18 24 18 90 6 72 15 36 9 48 6 36 42 48 0 78 3 54 27 18 36 48 15 54 12 30 24 84 12 18 0 18 12 105 12 24 30 30 18 36 0 60 30 27 12 48 0 90 6 18 18 33 21 42 24 24 12 45 24 60 36 36 0 66 6 27 15 42 24 60 12 18 9 30 18 84 12 72 0 12 6 42 21 45 12 18 9 96 12 21 30 30 24 66 0 48 12 42 18 36 18 24 24 24 0 30 12 27 42 18 0 72 0 84 27 54 15 102 12 36 6 39 36 36 15 36 0 30 15 57 12 57 42 30 9 60 6 27 42 27 30 36 0 54 6 24 21 78 12 42 18 18 12 84 18 54 18 48 0 66 12 15 36 30 18 72 9 66 0 27 18 24 6 78 0 42 6 81 27 27 36 24 24 48 0 72 18 39 30 42 0 18 18 30 24 78 6 18 18 36 0 48 30 84 6 18 0 54 0 42 36 12 30 90 12 48 18 24 18 21 18 48 0 60 0 60 6 30 42 24 18 66 0 27 36 24 18 54 0 48 6 30 18 90 15 42 9 48 18 42 6 45 24 36 0 48 0 78 39 27 12 42 27 48 6 45 18 72 36 48 0 18 9 66 9 54 33 18 18 66 12 39 36 45 12 72 0 48 12 21 39 33 18 60 18 36 0 78 18 39 36 24 0 30 0 30 30 54 21 66 6 30 21 39 18 60 15 72 0 30 18 45 12 39 18 60 6 66 15 36 30 12 18 60 0 60 0 18 33 57 18 24 24 42 6 66 12 81 42 18 0 36 6 42 18 24 24 72 0 18 0 30 30 87 18 36 0 42 3 45 12 36 42 24 25 30 6 72 24 18 18 60 0 102 12 42 12 90 12 24 27 24 12 69 24 30 18 42 0 48 0 42 45 39 15 60 18 30 12 33 24 72 18 36 0 24 12 51 24 39 36 24 6 120 0 72 24 30 30 30 0 24 12 72 18 54 3 84 30 30 21 42 24 30 18 30 0 54 0 36 30 24 30 72 9 72 6 30 24 36 24 30 0 30 0 90 12 48 27 24 6 54 12 39 36 18 18 78 0 36 12 18 39 66 6 54 18 36 0 54 18 42 12 30 0 78 0 48 45 27 36 36 9 54 15 6 12 99 15 48 0 24 3 60 12 45 36 36 30 24 12 57 30 42 18 54 0 36 6 45 24 63 30 60 12 42 6 102 18 30 33 18 0 84 12 54 24 39 12 42 0 36 0 54 24 60 12 42 0 48 6 30 9 93 24 18 21 60 6 21 36 18 54 102 0 30 18 36 21 48 12 30 27 42 3 54 12 66 36 36 0 48 9 45 33 30 9 84 18 30 12 33 36 51 12 54 0 36 18 42 12 30 36 24 9 72 0 48 30 36 6 78 0 42 0 18 24 63 21 36 18 24 15 66 0 42 27 54 0 30 9 51 45 45 24 48 12 72 12 33 24 39 30 66 0 18 6 69 12 36 24 36 18 90 6 60 24 36 27 36 0 60 18 33 21 84 12 36 30 18 0 33 24 51 30 24 0 84 0 57 33 36 21 84 12 30 12 33 36 63 18 24 0 30 6 90 21 66 30 30 24 36 0 54 12 51 18 78 0 36 0 18 18 54 21 48 12 66 18 21 18 33 21 42 0 66 6 48 54 21 30 66 12 66 0 24 24 63 24 36 0 42 3 60 18 30 6 36 9 54 6 72 48 36 15 54 0 30 27 12 18 60 12 66 15 48 10 84 12 39 42 12 0 66 6 24 18 21 36 54 24 24 12 51 18 66 12 90 0 18 6 87 15 75 24 30 15 60 0 24 42 24 24 48 0 84 6 51 39 60 12 18 30 36 12 60 12 60 48 36 0 54 6 42 12 6 18 78 6 48 12 12 36 84 0 48 0 54 3 48 18 45 51 54 6 72 6 51 30 45 30 48 0 36 6 36 15 78 24 42 24 24 0 90 18 36 24 24 0 36 0 36 30 30 30 66 6 78 21 30 12 21 15 60 0 36 12 66 21 36 24 30 18 60 9 54 48 24 18 48 0 30 6 42 18 81 18 54 27 24 12 30 18 84 30 24 0 102 9 42 42 36 24 90 3 30 0 60 30 42 18 24 0 18 0 78 12 42 27 42 18 66 18 45 18 42 9 84 0 54 6 15 54 63 18 54 24 24 9 57 24 45 54 36 0 60 0 66 27 33 18 30 9 60 24 30 12 54 21 24 0 12 18 108 15 66 12 30 27 66 0 36 30 36 24 66 0 60 0 9 24 54 12 90 15 42 0 51 30 18 30 48 0 84 9 48 21 54 30 24 18 36 12 45 18 96 6 30 0 30 9 30 24 42 24 24 15 66 6 69 36 15 15 84 0 36 15 48 27 45 18 42 30 36 0 66 6 72 30 48 0 42 3 51 39 30 33 78 12 24 18 30 18 105 21 72 0 42 12 39 18 27 42 24 6 66 3 60 42 30 30 60 0 54 6 54 24 57 6 54 6 24 24 54 12 57 27 42 0 48 6 36 27 57 12 84 12 60 0 12 30 54 24 48 0 18 3 105 36 48 42 24 18 48 6 30 36 45 42 42 0 54 9 36 12 48 12 54 30 30 6 48 6 51 18 36 0 102 6 18 30 33 24 48 18 60 12 60 30 45 12 36 0 54 12 60 6 48 54 12 13 60 0 72 18 24 6 90 0 48 12 15 42 96 18 36 18 36 6 78 24 48 18 30 0 48 18 78 42 24 30 60 6 60 12 18 12 42 30 42 0 24 0 81 9 54 18 60 33 48 0 27 54 51 27 90 0 60 18 24 18 54 24 36 12 42 0 87 24 33 18 24 0 96 0 87 36 30 15 42 12 36 24 24 36 42 21 48 0 30 6 42 18 48 24 24 18 84 3 36 42 42 36 72 0 54 6 30 15 60 6 78 30 24 6 72 6 66 45 24 0 42 21 36 30 36 18 48 12 30 0 39 24 102 18 36 0 12 6 54 6 30 33 66 21 90 3 78 36 9 18 36 0 84 0 30 30 93 24 30 24 30 15 63 12 48 30 54 0 48 0 54 42 42 30 78 0 36 24 39 24 60 12 78 0 60 6 51 30 36 36 30 18 60 0 30 30 51 24 60 0 42 3 24 9 54 21 24 33 30 24 66 24 69 18 30 0 102 15 54 24 15 30 120 6 30 3 51 24 54 12 30 0 36 6 36 12 90 42 12 12 60 12 60 24 42 12 90 0 24 12 42 30 30 6 78 21 42 0 54 24 27 54 24 0 66 6 45 30 12 30 42 12 84 15 36 18 84 24 36 0 30 18 72 18 60 24 48 12 54 6 36 54 42 12 42 0 60 0 51 48 54 9 36 27 24 6 84 18 48 30 42 0 78 0 48 27 27 48 42 18 36 0 39 18 99 24 102 0 18 0 48 18 72 15 36 12 84 12 24 12 30 39 84 0 36 12 39 39 63 24 42 24 66 6 72 18 18 24 30 0 60 6 48 42 36 15 78 6 48 30 12 36 54 12 36 0 42 6 45 6 69 24 72 21 48 0 57 48 12 24 48 0 48 3 48 15 78 24 60 18 12 12 111 24 54 24 24 0 48 6 36 33 42 6 54 9 72 18 27 30 30 12 54 0 66 4 78 21 24 54 18 24 54 6 60 24 54 21 78 0 36 18 54 30 66 18 48 30 24 0 42 12 99 36 30 0 90 6 18 30 30 24 78 6 66 9 24 42 78 30 42 0 18 12 102 6 33 24 18 12 66 9 54 24 24 36 84 0 60 6 39 15 78 12 42 21 42 18 42 18 18 42 24 0 48 3 105 51 42 30 42 18 72 0 24 24 102 6 36 0 36 9 99 12 48 21 48 18 42 6 36 42 18 12 78 0 48 30 30 18 36 30 42 9 42 6 60 12 39 30 24 0 78 0 48 30 39 27 102 24 30 12 51 12 66 9 48 0 30 18 45 39 87 30 36 9 72 0 60 24 30 36 54 0 48 0 45 36 45 18 42 27 60 9 66 12 78 42 18 0 60 6 60 33 36 24 96 12 18 12 12 36 72 0 78 0 36 6 60 24 27 51 42 24 84 12 57 48 30 24 42 0 60 12 24 18 96 12 30 30 30 0 93 18 48 18 60 0 48 6 54 36 30 12 42 9 60 18 12 24 69 6 60 0 54 6 33 15 60 36 30 18 90 3 72 24 54 54 42 0 18 9 60 30 84 18 48 24 12 6 66 36 24 27 24 0 42 12 39 42 27 18 108 9 78 0 48 12 54 30 30 0 36 0 48 12 75 39 30 6 42 9 66 30 33 18 96 0 48 18 39 36 102 12 54 18 24 9 45 24 72 30 36 0 78 6 63 36 36 21 60 9 36 12 54 24 78 27 42 0 42 18 60 9 24 24 54 39 84 0 27 36 39 12 84 0 66 0 21 30 30 42 66 18 18 18 78 12 48 42 36 0 90 6 48 33 39 24 48 15 54 15 54 24 48 18 60 0 24 0 48 24 78 24 36 9 90 12 42 24 30 45 54 0 66 12 24 12 60 6 48 33 48 0 60 6 51 54 12 0 30 0 69 21 42 15 72 15 48 21 33 36 96 6 30 0 54 6 87 30 42 30 36 13 42 6 84 48 18 18 72 0 54 12 30 30 75 24 36 24 42 18 78 12 36 30 72 0 48 6 33 36 57 36 66 6 54 0 27 36 66 12 90 0 24 3 96 24 27 24 18 24 108 12 42 48 24 18 30 0 54 18 48 12 75 18 90 21 36 12 72 12 45 24 24 0 114 0 27 30 39 33 48 12 54 12 18 42 45 27 48 0 48 6 90 9 60 42 36 12 48 0 36 42 42 18 78 0 30 6 24 33 78 9 84 30 18 15 63 18 51 30 48 0 72 6 36 51 24 30 48 21 96 6 24 6 93 12 48 0 18 6 69 18 36 18 24 18 24 6 54 36 51 33 96 0 36 15 27 30 54 30 42 12 36 0 117 36 54 36 24 0 96 3 72 36 57 27 54 6 54 21 36 12 66 33 60 0 30 24 24 15 63 30 42 24 78 9 39 30 24 24 138 0 42 0 54 24 57 12 30 24 42 18 54 6 60 33 24 0 72 6 84 24 42 6 66 15 36 0 42 48 51 18 66 0 60 3 60 12 60 57 42 9 72 12 60 42 27 24 60 0 42 18 24 30 48 30 36 18 30 9 78 12 51 18 30 0 60 0 12 57 51 18 78 6 102 12 30 24 48 27 36 0 30 12 126 6 27 36 30 18 66 0 60 30 48 36 48 0 24 6 39 24 96 12 90 33 36 6 39 6 90 27 36 0 60 12 45 42 30 30 72 12 36 9 39 36 69 24 48 0 36 6 66 15 72 39 36 27 54 18 57 30 42 12 60 0 84 24 36 27 72 12 48 21 60 0 51 30 27 30 90 0 78 0 42 57 12 30 48 18 42 6 48 24 90 15 42 0 12 15 84 24 72 18 48 21 66 3 54 42 30 24 48 0 36 18 27 12 42 9 108 18 36 12 96 24 21 30 24 0 96 9 54 18 75 30 54 18 36 0 39 18 84 18 42 0 24 6 54 18 57 42 24 9 84 18 48 42 27 30 78 0 60 0 30 48 36 6 30 36 6 10 78 12 51 48 48 0 90 0 75 9 42 24 48 15 72 12 33 42 108 12 54 0 54 18 51 42 36 48 48 12 72 0 42 18 45 30 66 0 78 3 36 15 78 30 30 30 30 15 102 12 54 18 30 0 36 6 81 48 12 24 108 6 78 18 24 36 33 18 30 0 30 0 108 21 54 42 18 18 90 6 30 48 69 36 48 0 24 15 24 15 84 24 114 6 30 0 48 6 60 42 24 0 102 12 42 42 27 21 78 9 42 24 51 24 42 12 48 0 60 12 66 6 42 24 30 24 42 0 78 24 54 12 66 0 30 6 24 51 99 18 60 24 42 18 54 6 45 60 36 0 54 6 39 39 39 30 66 18 72 0 51 24 102 12 54 0 24 0 102 12 48 24 42 36 60 0 12 48 18 12 54 0 84 18 39 9 84 30 66 18 48 15 72 48 39 42 48 0 60 0 84 30 45 33 54 6 54 30 33 30 90 6 54 0 24 6 72 27 78 12 24 15 66 0 54 36 21 42 114 0 60 3 30 33 54 27 30 33 60 6 54 12 48 33 36 0 42 12 45 39 24 36 96 18 24 12 33 18 99 18 66 0 36 0 51 24 30 30 36 15 84 6 102 48 48 18 60 0 72 12 36 42 60 12 24 21 30 0 54 18 60 18 42 0 66 6 24 24 54 15 78 12 42 27 27 30 51 27 78 0 48 6 120 27 48 42 24 12 54 6 54 24 48 36 66 0 78 9 57 21 48 18 54 33 24 30 84 18 45 33 30 0 126 9 36 30 27 30 66 18 54 0 36 42 48 6 42 0 54 6 57 12 84 54 48 6 60 6 63 18 42 36 78 0 24 24 33 24 105 24 66 27 48 0 48 30 60 30 54 0 42 3 75 48 24 12 66 12 96 6 30 12 87 21 36 0 30 24 69 12 57 30 48 24 54 0 42 54 24 24 72 0 60 0 48 24 69 24 42 18 36 12 66 24 36 42 18 0 78 9 48 36 42 42 36 12 36 21 78 18 48 12 102 0 18 12 54 24 45 27 42 13 108 12 39 24 42 27 102 0 60 6 39 24 54 12 54 24 24 0 114 24 63 48 30 0 48 6 69 36 18 12 72 6 48 18 33 54 117 12 42 0 66 12 48 6 54 36 42 21 102 6 48 54 33 30 48 0 72 0 30 24 75 24 84 30 30 0 72 18 30 42 54 0 60 12 36 45 42 12 96 6 66 0 12 36 78 36 42 0 36 0 78 24 48 24 18 30 90 15 96 18 27 21 54 0 24 21 48 27 84 18 48 42 36 6 66 12 108 12 42 0 48 9 27 60 21 36 84 6 36 18 42 18 54 18 60 0 60 15 72 9 99 42 12 12 60 0 57 42 18 18 78 0 42 6 36 36 63 9 42 15 30 18 78 6 24 48 42 0 102 12 75 45 42 30 84 24 66 9 24 30 90 24 42 0 24 3 84 21 84 33 66 24 36 6 36 48 51 18 72 0 66 18 54 30 24 18 48 18 30 0 102 12 45 36 24 0 102 3 42 15 42 54 54 21 66 24 66 30 102 3 66 0 48 12 24 30 45 36 54 6 78 9 48 24 39 36 96 0 66 6 27 27 60 30 18 30 48 12 90 24 60 36 6 0 42 12 78 36 36 24 114 6 60 0 18 6 69 18 84 0 36 6 48 6 39 24 42 24 54 6 72 48 36 42 60 0 48 0 36 18 138 24 30 30 42 18 75 18 48 18 24 0 78 0 78 57 60 9 48 9 36 30 30 42 42 39 84 0 24 12 87 27 30 42 24 24 90 0 36 24 60 36 84 0 42 0 30 21 87 12 72 24 42 12 60 30 72 21 60 0 96 12 30 42 39 18 66 12 84 12 63 42 42 24 42 0 18 6 78 15 75 45 54 12 54 6 84 30 30 18 54 0 42 24 39 27 96 18 42 21 48 0 54 18 33 36 66 0 84 0 75 48 30 42 54 12 54 15 42 30 96 18 42 0 18 6 123 15 48 24 48 39 42 6 21 54 45 12 60 0 90 12 30 36 45 18 72 21 78 12 30 12 60 30 18 0 78 6 60 36 33 18 60 12 30 0 60 18 90 30 54 0 36 1 78 27 84 30 18 15 102 9 27 30 24 57 90 0 42 9 48 42 42 12 72 27 48 9 108 18 48 48 18 0 84 6 66 24 48 21 114 6 78 24 30 30 42 18 60 0 18 12 63 9 51 66 48 15 54 0 66 60 36 18 48 0 66 6 36 30 96 9 36 30 30 24 93 24 72 24 66 0 60 24 48 30 24 30 72 6 60 12 30 12 93 18 72 0 30 0 81 30 36 48 36 30 90 6 54 24 57 24 36 0 54 18 36 24 78 18 72 33 12 0 51 30 48 24 42 0 90 3 78 30 30 27 138 6 30 18 36 24 75 24 12 0 54 12 42 18 84 36 30 18 66 6 45 36 36 48 114 0 24 6 30 21 108 15 48 18 36 18 57 24 63 42 54 0 78 6 81 36 18 24 42 18 120 0 24 24 66 12 54 0 48 12 66 18 42 36 48 18 72 6 48 48 33 6 102 0 54 24 39 54 60 12 90 18 36 3 111 24 51 48 42 0 90 0 45 36 54 48 54 24 18 18 51 18 72 0 54 0 18 12 54 36 57 18 42 18 120 0 63 42 27 36 48 0 54 6 39 30 81 18 72 33 54 9 72 12 54 54 24 0 54 15 75 24 60 12 78 6 30 12 39 54 72 6 54 0 72 6 78 12 54 39 30 15 48 6 57 48 18 24 90 0 90 18 42 24 39 42 24 30 42 0 84 6 66 30 30 0 30 0 27 42 39 33 90 24 84 18 51 36 69 24 54 0 42 18 87 33 51 18 42 9 126 9 84 36 66 18 54 0 36 0 66 12 48 15 54 30 18 18 60 18 96 54 42 0 102 0 27 36 30 36 108 15 54 0 24 36 60 24 66 0 30 0 54 15 75 48 36 18 48 24 36 36 54 15 108 0 84 18 "
m = map(int, s.split())
for _ in range(n):
  print(next(m))