#include <bits/stdc++.h>
using namespace std;
int N, Q;
int type[100010];
struct node {
  node *L, *R;
  int lo, hi;
  int cost[60];
  node(int _lo = 0, int _hi = 0, node* _L = NULL, node* _R = NULL) {
    lo = _lo, hi = _hi;
    L = _L, R = _R;
  }
  void set(int t) {
    fill(cost, cost + 60, 1);
    for (int i = 0; i < 60; i += t) cost[i] = 2;
  }
  void merge() {
    for (int i = 0; i < 60; ++i)
      cost[i] = L->cost[i] + R->cost[(i + L->cost[i]) % 60];
  }
};
node* build(int fr, int to) {
  if (fr == to) {
    node* ret = new node(fr, to);
    ret->set(type[fr]);
    return ret;
  }
  node* ret = new node(fr, to, build(fr, (fr + to) >> 1),
                       build(((fr + to) >> 1) + 1, to));
  ret->merge();
  return ret;
}
int get(node* vr, int f, int t, int go = 0) {
  if (!vr || t < vr->lo || vr->hi < f) return go;
  if (f <= vr->lo && vr->hi <= t) return go + vr->cost[go % 60];
  return get(vr->R, f, t, get(vr->L, f, t, go));
}
void update(node* vr, int pos, int neo) {
  if (!vr || pos < vr->lo || vr->hi < pos) return;
  if (vr->lo == vr->hi) return vr->set(neo);
  update(vr->L, pos, neo);
  update(vr->R, pos, neo);
  vr->merge();
}
int main() {
  char buf[5];
  int x, y;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) scanf("%d", &type[i]);
  node* root = build(0, N - 1);
  scanf("%d", &Q);
  for (int i = 0; i < Q; ++i) {
    scanf("%s%d%d", &buf, &x, &y);
    if (buf[0] == 'A')
      printf("%d\n", get(root, x - 1, y - 2, 0));
    else
      update(root, x - 1, y);
  }
  return 0;
}
