#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int st[N * 4][60];
int a[N];
void make(int l, int h, int root) {
  if (l == h) {
    for (int t = 0; t < 60; t++) {
      if (t % a[l] == 0)
        st[root][t] = 2;
      else
        st[root][t] = 1;
    }
    return;
  }
  int mid = l + h >> 1, c1 = 2 * root + 1, c2 = 2 * root + 2;
  make(l, mid, c1);
  make(mid + 1, h, c2);
  for (int t = 0; t < 60; t++)
    st[root][t] = st[c1][t] + st[c2][(t + st[c1][t]) % 60];
}
void update(int pos, int x, int l, int h, int root) {
  if (pos > h || pos < l) return;
  if (l == h) {
    for (int t = 0; t < 60; t++) {
      if (t % x == 0)
        st[root][t] = 2;
      else
        st[root][t] = 1;
    }
    return;
  }
  int mid = l + h >> 1, c1 = 2 * root + 1, c2 = 2 * root + 2;
  update(pos, x, l, mid, c1);
  update(pos, x, mid + 1, h, c2);
  for (int t = 0; t < 60; t++)
    st[root][t] = st[c1][t] + st[c2][(t + st[c1][t]) % 60];
}
int query(int ql, int qh, int l, int h, int root, int t) {
  if (h < ql || l > qh || l > h) return 0;
  if (ql <= l && h <= qh) return st[root][t];
  int mid = l + h >> 1, c1 = 2 * root + 1, c2 = 2 * root + 2;
  int q1 = query(ql, qh, l, mid, c1, t);
  int q2 = query(ql, qh, mid + 1, h, c2, (t + q1) % 60);
  return q1 + q2;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  make(0, n - 1, 0);
  int q;
  cin >> q;
  while (q--) {
    string c;
    cin >> c;
    int x, y;
    cin >> x >> y;
    if (c == "A")
      cout << query(x - 1, y - 2, 0, n - 1, 0, 0) << endl;
    else
      update(x - 1, y, 0, n - 1, 0);
  }
  return 0;
}
