#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int M = 60;
int v[N << 2][M];
void up(int rt) {
  for (int i = 0; i < M; i++) {
    v[rt][i] = v[rt << 1][i] + v[rt << 1 | 1][(i + v[rt << 1][i]) % M];
  }
}
void build(int l, int r, int rt) {
  if (l == r) {
    int a;
    scanf("%d", &a);
    for (int i = 0; i < M; i++) v[rt][i] = 1 + (i % a == 0);
    return;
  }
  int m = (l + r) >> 1;
  build(l, m, rt << 1);
  build(m + 1, r, rt << 1 | 1);
  up(rt);
}
void update(int p, int a, int l, int r, int rt) {
  if (l == r) {
    for (int i = 0; i < M; i++) v[rt][i] = 1 + (i % a == 0);
    return;
  }
  int m = (l + r) >> 1;
  if (p <= m)
    update(p, a, l, m, rt << 1);
  else
    update(p, a, m + 1, r, rt << 1 | 1);
  up(rt);
}
int ask(int L, int R, int l, int r, int rt, int p) {
  if (L <= l && r <= R) {
    return v[rt][p];
  }
  int ret = 0;
  int m = (l + r) >> 1;
  if (L <= m) ret += ask(L, R, l, m, rt << 1, p);
  if (R > m) ret += ask(L, R, m + 1, r, rt << 1 | 1, (p + ret) % M);
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  build(1, n, 1);
  int Q;
  scanf("%d", &Q);
  while (Q--) {
    char s[5];
    int x, y;
    scanf("%s %d %d", s, &x, &y);
    if (s[0] == 'C')
      update(x, y, 1, n, 1);
    else
      printf("%d\n", ask(x, y - 1, 1, n, 1, 0));
  }
  return 0;
}
