#include <bits/stdc++.h>
inline unsigned int getuint() {
  char w = getchar();
  while (w < '0' || '9' < w) w = getchar();
  unsigned int ans = 0;
  for (; '0' <= w && w <= '9'; w = getchar()) ans = ans * 10 + w - '0';
  return ans;
}
inline char getletter() {
  char w = getchar();
  while (w < 'A' || 'Z' < w) w = getchar();
  return w;
}
struct ZKW_SeGment_Tree {
  struct info {
    int t[60];
    info() { memset(t, 0, sizeof(int) * 60); }
    friend inline info operator+(const info &l, const info &r) {
      info ans = l;
      for (int i = 0; i < 60; i++) ans.t[i] += r.t[(i + l.t[i]) % 60];
      return ans;
    }
  } zkw[262144 + 233];
  int shift;
  inline info query(int l, int r) {
    info lans, rans;
    for (l += shift - 1, r += shift + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
      if (~l & 1) lans = lans + zkw[l ^ 1];
      if (r & 1) rans = zkw[r ^ 1] + rans;
    }
    return lans + rans;
  }
  inline void modify(int i, int x) {
    for (int j = 0; j < 60; j++) zkw[i + shift].t[j] = j % x ? 1 : 2;
    for ((i += shift) >>= 1; i; i >>= 1) zkw[i] = zkw[i << 1] + zkw[i << 1 | 1];
  }
  void init(int n, int *a) {
    for (shift = 1; shift <= n + 1; shift <<= 1)
      ;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j < 60; j++) zkw[i + shift].t[j] = j % a[i] ? 1 : 2;
    for (int i = shift - 1; i; i--) zkw[i] = zkw[i << 1] + zkw[i << 1 | 1];
  }
} ZKWSGT;
int main() {
  int n = getuint();
  static int a[100005];
  for (int i = 1; i <= n; i++) a[i] = getuint();
  ZKWSGT.init(n, a);
  for (int m = getuint(); m--;)
    if (getletter() == 'C') {
      int l = getuint(), x = getuint();
      ZKWSGT.modify(l, x);
    } else {
      int l = getuint(), r = getuint();
      printf("%d\n", ZKWSGT.query(l, r - 1).t[0]);
    }
  return 0;
}
