#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int tree[N << 2][60];
int n;
void update(int node, int st, int end, int idx, int val) {
  if (st == end) {
    for (int i = 0; i < 60; i++) {
      if (i % val == 0)
        tree[node][i] = 2;
      else
        tree[node][i] = 1;
    }
    return;
  }
  int mid = st + end >> 1;
  if (idx <= mid)
    update(node << 1, st, mid, idx, val);
  else
    update((node << 1) + 1, mid + 1, end, idx, val);
  for (int i = 0; i < 60; i++) {
    tree[node][i] = tree[node << 1][i] +
                    tree[(node << 1) + 1][(i + tree[node << 1][i]) % 60];
  }
}
int query(int node, int st, int end, int l, int r, int time) {
  if (r < st || l > end) {
    return 0;
  }
  if (l <= st && end <= r) {
    return tree[node][time];
  }
  int mid = st + end >> 1;
  int left = query(node << 1, st, mid, l, r, time);
  return (left +
          query((node << 1) + 1, mid + 1, end, l, r, (time + left) % 60));
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    update(1, 1, n, i, x);
  }
  int q;
  cin >> q;
  while (q--) {
    char ch;
    cin >> ch;
    if (ch == 'A') {
      int l, r;
      cin >> l >> r;
      cout << query(1, 1, n, l, r - 1, 0) << "\n";
    } else {
      int idx, val;
      cin >> idx >> val;
      update(1, 1, n, idx, val);
    }
  }
  return 0;
}
