#include <bits/stdc++.h>
const int vmax = 500000;
const int omax = 60;
using namespace std;
struct node {
  int ost[omax];
};
node v[vmax] = {0};
int n, m, x, y, p;
char c;
int build_tree(int n) {
  int j = 1;
  while (j < n) j *= 2;
  return j;
}
void makebase(int vn, int period) {
  int cur = 1;
  v[vn].ost[0] = 2;
  for (int i = 1; i < omax; ++i) {
    v[vn].ost[i] = (cur < period) ? 1 : 2;
    if (cur == period) cur = 0;
    cur++;
  }
}
void recount(int vn) {
  int phase;
  for (int i = 0; i < omax; ++i) {
    v[vn].ost[i] = v[2 * vn].ost[i];
    phase = (i + v[vn].ost[i]) % omax;
    v[vn].ost[i] += v[2 * vn + 1].ost[phase];
  }
}
void renew(int vn, int period) {
  makebase(vn, period);
  while ((vn >>= 1) > 0) recount(vn);
}
int find(int l, int r, int curt) {
  if (l > r) return 0;
  if (l == r) return v[l].ost[curt];
  int ans = 0;
  if ((l & 1) == 1) {
    ans += v[l].ost[curt];
    curt = (curt + v[l].ost[curt]) % omax;
    l++;
  }
  if ((r & 1) == 0) {
    int pres = find(l >> 1, (r - 1) >> 1, curt);
    ans += pres;
    curt = (curt + pres) % omax;
    ans += v[r].ost[curt];
  } else
    ans += find(l >> 1, r >> 1, curt);
  return ans;
}
int main(int argc, const char* argv[]) {
  cin >> n;
  p = build_tree(n);
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    makebase(p + i, x);
  }
  for (int i = p; i >= 1; --i) recount(i);
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> c >> x >> y;
    if (c == 'A')
      cout << find(p + x, p + y - 1, 0) << endl;
    else
      renew(p + x, y);
  }
  return 0;
}
