#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5, V = 60, MAXS = 4 * MAXN;
int n, a[MAXN], q, x, y;
char qt;
int tree[V][MAXS];
void upd(int v, int b, int e, int val) {
  int m = b + e >> 1;
  for (int i = 0; i < V; ++i) {
    if (b == e)
      tree[i][v] = i % val == 0 ? 1 : 0;
    else {
      int tl = tree[i][v + v];
      int rr = ((m - b + 1) + tl);
      int tr = tree[(i + rr) % V][v + v + 1];
      tree[i][v] = tl + tr;
    }
  }
}
void build(int v, int b, int e) {
  int m = b + e >> 1;
  if (b != e) {
    build(v + v, b, m);
    build(v + v + 1, m + 1, e);
  }
  upd(v, b, e, a[b]);
}
int query(int v, int b, int e, int l, int r, int rem) {
  if (l <= b && e <= r) return tree[rem][v] + (e - b + 1);
  if (e < l || b > r) return 0;
  int m = b + e >> 1;
  int tl = query(v + v, b, m, l, r, rem);
  int tr = query(v + v + 1, m + 1, e, l, r, (rem + tl) % V);
  return tl + tr;
}
void update(int v, int b, int e, int pos, int val) {
  int m = b + e >> 1;
  if (b != e) {
    if (pos <= m)
      update(v + v, b, m, pos, val);
    else
      update(v + v + 1, m + 1, e, pos, val);
  }
  upd(v, b, e, val);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  build(1, 1, n);
  cin >> q;
  for (int i = 0; i < q; ++i) {
    cin >> qt >> x >> y;
    if (qt == 'A') {
      cout << query(1, 1, n, x, y - 1, 0) << '\n';
    } else {
      update(1, 1, n, x, y);
    }
  }
  return 0;
}
