#include <bits/stdc++.h>
using namespace std;
static const int GCD = 60;
static const int MAXN = 100005;
int n;
int ai[MAXN];
int tim[MAXN * 4][GCD + 1];
void build(int start, int end, int node) {
  if (start == end) {
    for (int T = 0; T < GCD; T++) {
      if (T % ai[start] == 0)
        tim[node][T] = 2;
      else
        tim[node][T] = 1;
    }
    return;
  }
  build(start, (start + end) / 2, 2 * node);
  build((start + end) / 2 + 1, end, 2 * node + 1);
  for (int T = 0; T < GCD; T++) {
    tim[node][T] =
        tim[2 * node][T] + tim[2 * node + 1][(T + tim[2 * node][T]) % GCD];
  }
}
int query(int start, int end, int i, int j, int node, int T = 0) {
  if (start > j || end < i) return 0;
  if (start >= i && end <= j) return tim[node][T];
  int X = query(start, (start + end) / 2, i, j, 2 * node, T);
  int Y = query((start + end) / 2 + 1, end, i, j, 2 * node + 1, (T + X) % GCD);
  return (X + Y);
}
void update(int start, int end, int i, int node, int ne) {
  if (start > i || end < i) return;
  if (start == end) {
    ai[start] = ne;
    for (int T = 0; T < GCD; T++) {
      if (T % ai[start] == 0)
        tim[node][T] = 2;
      else
        tim[node][T] = 1;
    }
    return;
  }
  update(start, (start + end) / 2, i, 2 * node, ne);
  update((start + end) / 2 + 1, end, i, 2 * node + 1, ne);
  for (int T = 0; T < GCD; T++) {
    tim[node][T] =
        tim[2 * node][T] + tim[2 * node + 1][(T + tim[2 * node][T]) % GCD];
  }
}
int main() {
  scanf("%d", &n);
  for (int g = 1; g <= n; g++) scanf("%d", &ai[g]);
  build(1, n, 1);
  int q;
  scanf("%d", &q);
  for (int g = 0; g < q; g++) {
    char x;
    scanf("\n%c ", &x);
    if (x == 'C') {
      int a, b;
      scanf("%d %d", &a, &b);
      update(1, n, a, 1, b);
    } else {
      int a, b;
      scanf("%d %d", &a, &b);
      printf("%d\n", query(1, n, a, b - 1, 1));
    }
  }
  return 0;
}
