#include <bits/stdc++.h>
using namespace std;
int n, q, arr[131072], st[60][2 * 131072];
void build(int node, int low, int high) {
  if (low == high) {
    for (int start = 0; start < 60; start++) {
      if (start % arr[low] == 0)
        st[start][node] = 2;
      else
        st[start][node] = 1;
    }
    return;
  }
  build(2 * node + 1, low, (low + high) / 2);
  build(2 * node + 2, (low + high) / 2 + 1, high);
  for (int i = 0; i < 60; i++) {
    st[i][node] =
        st[i][2 * node + 1] + st[(i + st[i][2 * node + 1]) % 60][2 * node + 2];
  }
}
void update(int node, int low, int high, int x, int y) {
  if (x < low || x > high) return;
  if (low == high) {
    for (int i = 0; i < 60; i++) {
      arr[x] = y;
      if (i % arr[x] == 0)
        st[i][node] = 2;
      else
        st[i][node] = 1;
    }
    return;
  }
  update(2 * node + 1, low, (low + high) / 2, x, y);
  update(2 * node + 2, (low + high) / 2 + 1, high, x, y);
  for (int i = 0; i < 60; i++) {
    st[i][node] =
        st[i][2 * node + 1] + st[(i + st[i][2 * node + 1]) % 60][2 * node + 2];
  }
}
int query(int node, int low, int high, int x, int y, int start) {
  if (y < low || x > high) return 0;
  if (x == low && high == y) {
    return st[start][node];
  }
  if (y <= (low + high) / 2)
    return query(2 * node + 1, low, (low + high) / 2, x, y, start);
  if (x >= (low + high) / 2 + 1)
    return query(2 * node + 2, (low + high) / 2 + 1, high, x, y, start);
  int s2 =
      query(2 * node + 1, low, (low + high) / 2, x, (low + high) / 2, start);
  int s3 = query(2 * node + 2, (low + high) / 2 + 1, high, (low + high) / 2 + 1,
                 y, (start + s2) % 60);
  return s2 + s3;
}
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", arr + i);
  build(0, 0, n - 1);
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    char c;
    cin >> c;
    int x, y;
    scanf("%d %d", &x, &y);
    if (c == 'A')
      printf("%d\n", query(0, 0, n - 1, x - 1, y - 2, 0));
    else
      update(0, 0, n - 1, x - 1, y);
  }
  return 0;
}
