#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101000;
const int MAXS = 60;
int tree[MAXS][MAXN << 2], a[MAXN], n;
void up(int p) {
  for (register int i = 0; i < MAXS; ++i)
    tree[i][p] =
        tree[i][p << 1] + tree[(i + tree[i][p << 1]) % MAXS][p << 1 | 1];
}
int ask(int u, int l, int r, int ll, int rr, int p) {
  if (ll <= l && r <= rr) return tree[p][u];
  int res(0), m = (l + r) >> 1;
  if (ll <= m) res = ask(u << 1, l, m, ll, rr, p);
  if (m < rr) res += ask(u << 1 | 1, m + 1, r, ll, rr, (p + res) % MAXS);
  return res;
}
void modify(int u, int l, int r, int first, int p) {
  if (l == r) {
    for (register int i = 0; i < MAXS; ++i) tree[i][u] = (i % p == 0) + 1;
    return;
  }
  int m = (l + r) >> 1;
  if (first <= m)
    modify(u << 1, l, m, first, p);
  else
    modify(u << 1 | 1, m + 1, r, first, p);
  up(u);
}
void work() {
  int T, first, second;
  char ch;
  scanf("%d", &T);
  while (T--) {
    ch = getchar();
    while (ch != 'A' && ch != 'C') ch = getchar();
    if (ch == 'A') {
      scanf("%d%d", &first, &second);
      printf("%d\n", ask(1, 1, n, first, second - 1, 0));
    } else {
      scanf("%d%d", &first, &second);
      modify(1, 1, n, first, second);
    }
  }
}
void build(int u, int l, int r) {
  if (l == r) {
    for (register int i = 0; i < MAXS; ++i) tree[i][u] = (i % a[l] == 0) + 1;
    return;
  }
  int m = (l + r) >> 1;
  build(u << 1, l, m);
  build(u << 1 | 1, m + 1, r);
  up(u);
}
void init() {
  scanf("%d", &n);
  for (register int i = (1), _end_ = (n); i <= _end_; ++i) scanf("%d", &a[i]);
  build(1, 1, n);
}
int main() {
  init();
  work();
  return 0;
}
