#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const long long linf = 1e18 + 5;
const int N = 1e5 + 5;
const int LCM = 60;
int n, m, x, y, a[N], kd[4 * N][LCM];
char c;
void init(int root, int bas, int son) {
  if (bas == son) {
    for (int i = 0; i <= LCM - 1; i++) kd[root][i] = 1 + (i % a[bas] == 0);
    return;
  }
  init((root << 1), bas, ((bas + son) >> 1));
  init(((root << 1) | 1), ((bas + son) >> 1) + 1, son);
  for (int i = 0; i <= LCM - 1; i++)
    kd[root][i] = kd[(root << 1)][i] +
                  kd[((root << 1) | 1)][(i + kd[(root << 1)][i]) % 60];
}
int query(int root, int bas, int son, int x, int y, int time) {
  if (son < x or y < bas) return 0;
  if (x <= bas and son <= y) return kd[root][time % 60];
  int start = time;
  time += query((root << 1), bas, ((bas + son) >> 1), x, y, time);
  time += query(((root << 1) | 1), ((bas + son) >> 1) + 1, son, x, y, time);
  return time - start;
}
void update(int root, int bas, int son, int x, int val) {
  if (son < x or x < bas) return;
  if (x <= bas and son <= x) {
    a[x] = val;
    for (int i = 0; i <= LCM - 1; i++) kd[root][i] = 1 + (i % val == 0);
    return;
  }
  update((root << 1), bas, ((bas + son) >> 1), x, val);
  update(((root << 1) | 1), ((bas + son) >> 1) + 1, son, x, val);
  for (int i = 0; i <= LCM - 1; i++)
    kd[root][i] = kd[(root << 1)][i] +
                  kd[((root << 1) | 1)][(i + kd[(root << 1)][i]) % 60];
}
int main() {
  ios ::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  init(1, 1, n);
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> c >> x >> y;
    if (c == 'A')
      cout << query(1, 1, n, x, y - 1, 0) << '\n';
    else
      update(1, 1, n, x, y);
  }
  return 0;
}
