#include <bits/stdc++.h>
using namespace std;
const int maxn = 100050;
struct seg {
  int val[60];
  seg() { memset(val, 0, sizeof(val)); }
};
seg s[maxn << 2];
int a[maxn];
char op[5];
int n, q;
void pushup(int x) {
  for (int i = 0; i < 60; i++) {
    int t0 = (i + s[x << 1].val[i]) % 60;
    s[x].val[i] = s[x << 1].val[i] + s[x << 1 | 1].val[t0];
  }
}
void build(int x, int l, int r) {
  if (l == r) {
    for (int i = 0; i < 60; i++) s[x].val[i] = (i % a[l] == 0) ? 2 : 1;
    return;
  }
  int mid = (l + r) >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  pushup(x);
}
void update(int x, int l, int r, int k, int _val) {
  if (l == r) {
    a[l] = _val;
    for (int i = 0; i < 60; i++) s[x].val[i] = (i % a[l] == 0) ? 2 : 1;
    return;
  }
  int mid = (l + r) >> 1;
  if (mid >= k) update(x << 1, l, mid, k, _val);
  if (mid < k) update(x << 1 | 1, mid + 1, r, k, _val);
  pushup(x);
}
seg query(int x, int l, int r, int L, int R) {
  if (L <= l && r <= R) return s[x];
  int mid = (l + r) >> 1;
  if (mid >= R)
    return query(x << 1, l, mid, L, R);
  else if (mid < L)
    return query(x << 1 | 1, mid + 1, r, L, R);
  else {
    seg s1 = query(x << 1, l, mid, L, mid);
    seg s2 = query(x << 1 | 1, mid + 1, r, mid + 1, R);
    seg s0;
    for (int i = 0; i < 60; i++) {
      int t0 = (i + s1.val[i]) % 60;
      s0.val[i] = s1.val[i] + s2.val[t0];
    }
    return s0;
  }
}
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  build(1, 1, n);
  scanf("%d", &q);
  while (q--) {
    int x, y;
    scanf("%s %d %d", op, &x, &y);
    if (op[0] == 'C')
      update(1, 1, n, x, y);
    else if (op[0] == 'A')
      printf("%d\n", query(1, 1, n, x, y - 1).val[0]);
  }
}
int main() {
  solve();
  return 0;
}
