#include <bits/stdc++.h>
const int GAP = 131072, LCM = 60;
int n, tree[GAP << 1][LCM], right[GAP << 1], numQuery;
void init(int pos, int num) {
  for (int i = 0; i < LCM; i++) tree[pos][i] = i % num == 0 ? 2 : 1;
}
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    init(GAP + i, t);
  }
  scanf("%d", &numQuery);
}
void combine(int num) {
  int l = num * 2, r = num * 2 + 1;
  for (int i = 0; i < LCM; i++)
    tree[num][i] = tree[l][i] + tree[r][(i + tree[l][i]) % LCM];
}
void initTree() {
  for (int i = GAP; i < GAP * 2; i++) right[i] = i - GAP;
  for (int i = GAP - 1; i > 0; i--) {
    combine(i);
    right[i] = right[i * 2 + 1];
  }
}
int query(int f, int s) {
  int current = 0, now = f + GAP;
  while (now <= s + GAP) {
    if ((now & 1) == 0 && right[now >> 1] <= s) {
      now >>= 1;
    } else {
      current += tree[now][current % LCM];
      now = right[now] + GAP + 1;
    }
  }
  return current;
}
void solve() {
  for (int i = 0; i < numQuery; i++) {
    int x, y;
    char type[2];
    scanf("%s%d%d", type, &x, &y);
    if (type[0] == 'C') {
      x--;
      init(GAP + x, y);
      for (int now = ((GAP + x) >> 1); now > 0; now >>= 1) combine(now);
    } else if (type[0] == 'A') {
      printf("%d\n", query(x - 1, y - 2));
    }
  }
}
int main() {
  input();
  initTree();
  solve();
  return 0;
}
