#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int MAXM = 60;
int sum[MAXN << 2][MAXM];
void push_up(int rt) {
  for (int i = 0; i < MAXM; ++i)
    sum[rt][i] =
        sum[rt << 1][i] + sum[rt << 1 | 1][(i + sum[rt << 1][i]) % MAXM];
}
void build(int l, int r, int rt) {
  if (l == r) {
    int val;
    scanf("%d", &val);
    for (int i = 0; i < MAXM; ++i) sum[rt][i] = 1 + (i % val == 0);
    return;
  }
  int m = l + r >> 1;
  build(l, m, rt << 1);
  build(m + 1, r, rt << 1 | 1);
  push_up(rt);
}
void update(int p, int val, int l, int r, int rt) {
  if (l == r) {
    for (int i = 0; i < MAXM; ++i) sum[rt][i] = 1 + (i % val == 0);
    return;
  }
  int m = l + r >> 1;
  if (p <= m)
    update(p, val, l, m, rt << 1);
  else
    update(p, val, m + 1, r, rt << 1 | 1);
  push_up(rt);
}
void query(int L, int R, int l, int r, int rt, int &ret) {
  if (L <= l && r <= R) {
    ret += sum[rt][ret % MAXM];
    return;
  }
  int m = l + r >> 1;
  if (L <= m) query(L, R, l, m, rt << 1, ret);
  if (m < R) query(L, R, m + 1, r, rt << 1 | 1, ret);
}
int main() {
  int n, q, x, y, ans;
  char c;
  scanf("%d", &n);
  build(1, n, 1);
  scanf("%d", &q);
  while (q--) {
    scanf(" %c%d%d", &c, &x, &y);
    switch (c) {
      case 'A':
        ans = 0;
        query(x, y - 1, 1, n, 1, ans);
        printf("%d\n", ans);
        break;
      case 'C':
        update(x, y, 1, n, 1);
        break;
    }
  }
}
