#include <bits/stdc++.h>
using namespace std;
int n, m, a[100010], t[400010][62];
inline void init(int u, int x) {
  for (int i = 0; i < 60; i++) t[u][i] = 1 + (i % x == 0);
}
void pushup(int u) {
  for (int i = 0; i < 60; i++)
    t[u][i] = t[u * 2][i] + t[u * 2 + 1][(i + t[u * 2][i]) % 60];
}
void build(int u, int l, int r) {
  if (l >= r) {
    init(u, a[l]);
    return;
  }
  int mid = (l + r) >> 1;
  build(u * 2, l, mid), build(u * 2 + 1, mid + 1, r);
  pushup(u);
}
void mdy(int u, int l, int r, int x, int w) {
  if (l >= r) {
    init(u, w);
    return;
  }
  int mid = (l + r) >> 1;
  x <= mid ? mdy(u * 2, l, mid, x, w) : mdy(u * 2 + 1, mid + 1, r, x, w);
  pushup(u);
}
int ask(int u, int l, int r, int L, int R, int nn) {
  if (L <= l && r <= R) return t[u][nn];
  int mid = (l + r) >> 1, ans = 0;
  if (L <= mid) ans += ask(u * 2, l, mid, L, R, nn);
  if (R > mid) ans += ask(u * 2 + 1, mid + 1, r, L, R, (nn + ans) % 60);
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  build(1, 1, n);
  scanf("%d", &m);
  while (m--) {
    char opt = getchar();
    while (opt < 'A' || opt > 'Z') opt = getchar();
    if (opt == 'C') {
      int x, y;
      scanf("%d%d", &x, &y);
      mdy(1, 1, n, x, y);
    } else {
      int x, y;
      scanf("%d%d", &x, &y);
      printf("%d\n", ask(1, 1, n, x, y - 1, 0));
    }
  }
  return 0;
}
