#include <bits/stdc++.h>
using namespace std;
const int MN = 100111;
int a[MN];
struct Node {
  int go[60];
} it[MN * 4];
Node operator+(const Node& a, const Node& b) {
  Node res;
  for (int x = 0, _a = (60); x < _a; x++) {
    res.go[x] = a.go[x] + b.go[(x + a.go[x]) % 60];
  }
  return res;
}
Node init(int a) {
  Node res;
  for (int x = 0, _a = (60); x < _a; x++) {
    res.go[x] = (x % a) ? 1 : 2;
  }
  return res;
}
void build(int i, int l, int r) {
  if (l == r) {
    it[i] = init(a[l]);
    return;
  }
  int mid = (l + r) >> 1;
  build(((i) << 1), l, mid);
  build((((i) << 1) + 1), mid + 1, r);
  it[i] = it[((i) << 1)] + it[(((i) << 1) + 1)];
}
void update(int i, int l, int r, int u, int val) {
  if (u < l || r < u) return;
  if (l == r) {
    it[i] = init(val);
    return;
  }
  int mid = (l + r) >> 1;
  update(((i) << 1), l, mid, u, val);
  update((((i) << 1) + 1), mid + 1, r, u, val);
  it[i] = it[((i) << 1)] + it[(((i) << 1) + 1)];
}
Node get(int i, int l, int r, int u, int v) {
  if (u <= l && r <= v) return it[i];
  int mid = (l + r) >> 1;
  if (v <= mid) return get(((i) << 1), l, mid, u, v);
  if (mid + 1 <= u) return get((((i) << 1) + 1), mid + 1, r, u, v);
  Node left = get(((i) << 1), l, mid, u, v);
  Node right = get((((i) << 1) + 1), mid + 1, r, u, v);
  return left + right;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << (fixed) << setprecision(9);
  int n;
  while (cin >> n) {
    for (int i = (1), _b = (n); i <= _b; i++) cin >> a[i];
    build(1, 1, n);
    int q;
    cin >> q;
    while (q--) {
      char typ;
      cin >> typ;
      if (typ == 'C') {
        int u, val;
        cin >> u >> val;
        update(1, 1, n, u, val);
      } else {
        int u, v;
        cin >> u >> v;
        --v;
        Node res = get(1, 1, n, u, v);
        cout << res.go[0] << "\n";
      }
    }
  }
  return 0;
}
