#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5 + 1;
int n, q, x, y, tree[60][MaxN << 2];
void Modify(int x, int l, int r, int p, int v) {
  if (l > r || l > p || r < p) return;
  if (l == r) {
    for (int i = 0; i <= 59; i++) tree[i][x] = (i % v) ? 1 : 2;
    return;
  }
  int mid = (l + r) >> 1;
  if (p <= mid)
    Modify(x << 1, l, mid, p, v);
  else
    Modify(x << 1 | 1, mid + 1, r, p, v);
  for (int i = 0; i <= 59; i++) {
    int ans = tree[i][x << 1];
    tree[i][x] = ans + tree[(i + ans) % 60][x << 1 | 1];
  }
}
int Request(int x, int l, int r, int L, int R, int t) {
  if (l > r || l > R || r < L) return 0;
  if (L <= l && r <= R) return tree[t][x];
  int mid = (l + r) >> 1;
  if (R <= mid) return Request(x << 1, l, mid, L, R, t);
  if (L > mid) return Request(x << 1 | 1, mid + 1, r, L, R, t);
  int ans = Request(x << 1, l, mid, L, R, t);
  return ans + Request(x << 1 | 1, mid + 1, r, L, R, (t + ans) % 60);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    Modify(1, 1, n, i, x);
  }
  char c[5];
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%s", &c);
    scanf("%d%d", &x, &y);
    if (c[0] == 'A') printf("%d\n", Request(1, 1, n, x, y - 1, 0));
    if (c[0] == 'C') Modify(1, 1, n, x, y);
  }
  return 0;
}
