#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, mn[maxn], q, ans;
struct node {
  int t[65];
  node() { fill_n(t, 65, 0); }
} seg[4 * maxn];
void make(int id, int sl, int sr) {
  if (sr - sl == 1) {
    for (int i = 0; i < 60; i++)
      if (i % mn[sl] == 0)
        seg[id].t[i] = 2;
      else
        seg[id].t[i] = 1;
    return;
  }
  int mid = (sl + sr) / 2;
  make(2 * id, sl, mid);
  make(2 * id + 1, mid, sr);
  for (int i = 0; i < 60; i++)
    seg[id].t[i] =
        seg[2 * id + 1].t[(seg[2 * id].t[i] + i) % 60] + seg[2 * id].t[i];
  return;
}
void upt(int id, int sl, int sr, int i, int val) {
  if (sr - sl == 1) {
    mn[sl] = val;
    for (int j = 0; j < 60; j++)
      if (j % mn[sl] == 0)
        seg[id].t[j] = 2;
      else
        seg[id].t[j] = 1;
    return;
  }
  int mid = (sl + sr) / 2;
  if (mid > i)
    upt(2 * id, sl, mid, i, val);
  else
    upt(2 * id + 1, mid, sr, i, val);
  for (int j = 0; j < 60; j++)
    seg[id].t[j] =
        seg[2 * id + 1].t[(seg[2 * id].t[j] + j) % 60] + seg[2 * id].t[j];
  return;
}
void get(int id, int sl, int sr, int l, int r) {
  int u = max(0, min(r, sr) - max(sl, l));
  if (u == 0) return;
  if (u == sr - sl) {
    ans += seg[id].t[ans % 60];
    return;
  }
  int mid = (sl + sr) / 2;
  get(2 * id, sl, mid, l, r);
  get(2 * id + 1, mid, sr, l, r);
  return;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> mn[i];
  make(1, 0, n);
  cin >> q;
  for (int i = 0; i < q; i++) {
    char type;
    int l, r;
    cin >> type >> l >> r;
    if (type == 'C') {
      l--;
      upt(1, 0, n, l, r);
    } else {
      l--, r--;
      ans = 0;
      get(1, 0, n, l, r);
      cout << ans << endl;
    }
  }
}
