#include <bits/stdc++.h>
using namespace std;
int H[60][100100 << 2], sol, v[100100], n, m, x, y, l, r;
char ch;
void huehue(int x) {
  int lef = (x << 1);
  int rig = (x << 1) + 1;
  for (int j = 0; j <= 59; ++j) {
    int costu = H[j][lef];
    int cost = H[j][lef];
    cost += j;
    cost %= 60;
    costu += H[cost][rig];
    H[j][x] = costu;
  }
}
void go(int st, int dr, int po) {
  if (st == dr) {
    for (int j = 0; j <= 59; ++j)
      if (j % v[st] == 0)
        H[j][po] = 2;
      else
        H[j][po] = 1;
    return;
  }
  int mij = (st + dr) >> 1;
  go(st, mij, po << 1);
  go(mij + 1, dr, (po << 1) + 1);
  huehue(po);
}
void upd(int st, int dr, int po, int poz, int x) {
  if (st == dr) {
    for (int j = 0; j <= 59; ++j)
      if (j % x == 0)
        H[j][po] = 2;
      else
        H[j][po] = 1;
    return;
  }
  int mij = (st + dr) >> 1;
  if (poz <= mij)
    upd(st, mij, po << 1, poz, x);
  else
    upd(mij + 1, dr, (po << 1) + 1, poz, x);
  huehue(po);
}
void query(int st, int dr, int po, int l, int r) {
  if (st >= l && dr <= r) {
    sol += H[sol % 60][po];
    return;
  }
  int mij = (st + dr) >> 1;
  if (l <= mij) query(st, mij, po << 1, l, r);
  if (r > mij) query(mij + 1, dr, (po << 1) + 1, l, r);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> v[i];
  go(1, n, 1);
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> ch;
    if (ch == 'A') {
      sol = 0;
      cin >> l >> r;
      --r;
      query(1, n, 1, l, r);
      cout << sol << "\n";
    } else {
      cin >> x >> y;
      upd(1, n, 1, x, y);
    }
  }
  return 0;
}
