#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T re() {
  T N = 0;
  char c = getchar();
  bool neg = 0;
  for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-';
  for (; c >= '0' && c <= '9'; c = getchar()) N = (N << 3) + (N << 1) + c - '0';
  return neg ? -N : N;
}
const int MX = 1e5;
int n, q;
int a[MX + 5];
struct Node {
  int res[60], end;
  Node(int e = 0x3f3f3f3f) : end(e) {
    for (int i = 0; i < 60; i++) res[i] = (i % end ? 1 : 2);
  }
  Node operator+(const Node &rhs) const {
    Node ret;
    for (int i = 0; i < 60; i++) {
      int newtime = res[i];
      ret.res[i] = newtime + rhs.res[(i + newtime) % 60];
    }
    ret.end = rhs.end;
    return ret;
  }
} st[MX * 4 + 10];
void build(int p = 1, int l = 1, int r = n) {
  if (l == r) return void(st[p] = Node(a[l]));
  int md = (l + r) >> 1;
  build(p << 1, l, md);
  build(p << 1 | 1, md + 1, r);
  st[p] = st[p << 1] + st[p << 1 | 1];
}
void upd(int i, int x, int p = 1, int l = 1, int r = n) {
  if (l == r) {
    a[l] = x;
    st[p] = Node(x);
    return;
  }
  int md = (l + r) >> 1;
  if (i <= md)
    upd(i, x, p << 1, l, md);
  else
    upd(i, x, p << 1 | 1, md + 1, r);
  st[p] = st[p << 1] + st[p << 1 | 1];
}
int query(int i, int j, int p = 1, int l = 1, int r = n, int cur = 0) {
  if (i > j || j < l || i > r) return 0;
  if (i <= l && j >= r) return st[p].res[cur];
  int md = (l + r) >> 1;
  int froml = query(i, j, p << 1, l, md, cur);
  int fromr = query(i, j, p << 1 | 1, md + 1, r, (cur + froml) % 60);
  return froml + fromr;
}
inline void init() { build(); }
inline int get(int l, int r) { return query(l, r - 1); }
void setval(int pos, int v) { upd(pos, v); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  init();
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    char buf[5];
    int x, y;
    scanf("%s %d %d", buf, &x, &y);
    if (buf[0] == 'C') {
      setval(x, y);
    } else {
      printf("%d\n", get(x, y));
    }
  }
  return 0;
}
