#include <bits/stdc++.h>
#pragma GCC optimize "O3"
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int M = 1 << 17;
const int K = 60;
int n;
int tree[M * 2 + 5][K];
void add(int pos, int val) {
  pos += M;
  for (int i = 0; i <= K - 1; i++) {
    tree[pos][i] = 1;
    if (i % val == 0) tree[pos][i]++;
  }
  pos >>= 1;
  while (pos) {
    for (int i = 0; i <= K - 1; i++)
      tree[pos][i] =
          tree[pos * 2][i] + tree[pos * 2 + 1][(i + tree[pos * 2][i]) % 60];
    pos >>= 1;
  }
}
int query(int l, int r) {
  int lewy[K], prawy[K], copy[K];
  for (int i = 0; i <= K - 1; i++) lewy[i] = prawy[i] = copy[i] = 0;
  l += M;
  r += M;
  while (l <= r) {
    if (l & 1) {
      for (int i = 0; i <= K - 1; i++)
        lewy[i] = lewy[i] + tree[l][(i + lewy[i]) % 60];
      l++;
    }
    if (!(r & 1)) {
      for (int i = 0; i <= K - 1; i++) copy[i] = prawy[i];
      for (int i = 0; i <= K - 1; i++)
        prawy[i] = tree[r][i] + copy[(i + tree[r][i]) % 60];
      r--;
    }
    l >>= 1;
    r >>= 1;
  }
  return lewy[0] + prawy[lewy[0] % 60];
}
void solve() {
  int a, b, q;
  char c;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    add(i, a);
  }
  cin >> q;
  for (int i = 1; i <= q; i++) {
    cin >> c >> a >> b;
    if (c == 'A')
      cout << query(a, b - 1) << '\n';
    else
      add(a, b);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
