#include <bits/stdc++.h>
using namespace std;
const int Max = 1e5 + 10;
struct Node {
  int p[60];
  Node() {
    for (int i = 0; i < 60; i++) p[i] = 0;
  }
  Node(int a) {
    for (int i = 0; i < 60; i++) p[i] = 1 + ((i % a) == 0);
  }
};
Node merge(Node a, Node b) {
  if (a.p[0] == 0) return b;
  if (b.p[0] == 0) return a;
  Node res;
  for (int i = 0; i < 60; i++) res.p[i] = a.p[i] + b.p[(a.p[i] + i) % 60];
  return res;
}
int A[Max];
Node seg[Max * 4];
int n;
void build(int tl = 1, int tr = n + 1, int idx = 1) {
  if (tr - tl == 1) {
    seg[idx] = {A[tl]};
    return;
  }
  int mid = (tl + tr) / 2;
  build(tl, mid, idx * 2);
  build(mid, tr, idx * 2 + 1);
  seg[idx] = merge(seg[idx * 2], seg[idx * 2 + 1]);
}
void upd(int i, int x, int tl = 1, int tr = n + 1, int idx = 1) {
  if (tr - tl == 1) {
    seg[idx] = {x};
    return;
  }
  int mid = (tl + tr) / 2;
  if (i < mid)
    upd(i, x, tl, mid, idx * 2);
  else
    upd(i, x, mid, tr, idx * 2 + 1);
  seg[idx] = merge(seg[idx * 2], seg[idx * 2 + 1]);
}
Node get(int l, int r, int tl = 1, int tr = n + 1, int idx = 1) {
  if (l <= tl && tr <= r) return seg[idx];
  if (r <= tl || tr <= l) return {};
  int mid = (tl + tr) / 2;
  return merge(get(l, r, tl, mid, idx * 2), get(l, r, mid, tr, idx * 2 + 1));
}
int main() {
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  build();
  int q;
  cin >> q;
  while (q--) {
    char ty;
    cin >> ty;
    int l, r;
    cin >> l >> r;
    if (ty == 'C') {
      upd(l, r);
    } else {
      Node ans = get(l, r);
      cout << (ans.p[1] + 1) << '\n';
    }
  }
}
