#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000 + 20;
int n, m, a[MAXN];
struct seg {
  int l, r;
  int t[60];
} tr[MAXN * 4];
seg merge(seg a, seg b) {
  seg tmp;
  tmp.l = a.l;
  tmp.r = b.r;
  for (int i = 0; i < 60; i++) tmp.t[i] = a.t[i] + b.t[(i + a.t[i]) % 60];
  return tmp;
}
void upp(int p) { tr[p] = merge(tr[(p << 1)], tr[((p << 1) | 1)]); }
void build(int p, int l, int r) {
  tr[p].l = l;
  tr[p].r = r;
  if ((tr[p].l == tr[p].r)) {
    int val;
    scanf("%d", &val);
    for (int i = 0; i < 60; i++) tr[p].t[i] = (i % val) ? 1 : 2;
    return;
  }
  int mid = (l + r) >> 1;
  build((p << 1), l, mid);
  build(((p << 1) | 1), mid + 1, r);
  upp(p);
}
void ins(int p, int x, int val) {
  int l = tr[p].l, r = tr[p].r;
  if ((tr[p].l == tr[p].r)) {
    for (int i = 0; i < 60; i++) tr[p].t[i] = (i % val) ? 1 : 2;
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    ins((p << 1), x, val);
  else
    ins(((p << 1) | 1), x, val);
  upp(p);
}
seg qry(int p, int x, int y) {
  int l = tr[p].l, r = tr[p].r;
  if (((l == x) && (y == r))) return tr[p];
  int mid = (l + r) >> 1;
  if (y <= mid)
    return qry((p << 1), x, y);
  else if (mid < x)
    return qry(((p << 1) | 1), x, y);
  else
    return merge(qry((p << 1), x, mid), qry(((p << 1) | 1), mid + 1, y));
}
int main() {
  scanf("%d", &n);
  build(1, 1, n);
  scanf("%d", &m);
  char s[5];
  int x, y;
  while (m--) {
    scanf("%s", s);
    scanf("%d%d", &x, &y);
    if (s[0] == 'A') {
      printf("%d\n", qry(1, x, y - 1).t[0]);
    }
    if (s[0] == 'C') {
      ins(1, x, y);
    }
  }
  return 0;
}
