#include <bits/stdc++.h>
using namespace std;
int tree[60][500000];
int n, m;
int a[600000];
void build(int v, int l, int r) {
  if (l == r) {
    for (int i = 0; i < 60; ++i) {
      tree[i][v] = 1;
      if (i % a[l] == 0) tree[i][v]++;
    }
    return;
  }
  int m = (l + r) / 2;
  build(v + v, l, m);
  build(v + v + 1, m + 1, r);
  for (int i = 0; i < 60; ++i) {
    int val = tree[i][v + v];
    tree[i][v] = val + tree[(i + val) % 60][v + v + 1];
  }
}
int get(int v, int l, int r, int ll, int rr, int P) {
  if (l == ll && r == rr) return tree[P % 60][v];
  int m = (l + r) / 2;
  if (m >= rr)
    return get(v + v, l, m, ll, rr, P);
  else if (m < ll)
    return get(v + v + 1, m + 1, r, ll, rr, P);
  int t = get(v + v, l, m, ll, m, P);
  P += t;
  int tmp = t + get(v + v + 1, m + 1, r, m + 1, rr, P);
  return tmp;
}
void update(int v, int l, int r, int pos, int val) {
  if (l == r) {
    for (int i = 0; i < 60; ++i) {
      tree[i][v] = 1;
      if (i % val == 0) tree[i][v]++;
    }
    return;
  }
  int m = (l + r) / 2;
  if (m >= pos)
    update(v + v, l, m, pos, val);
  else
    update(v + v + 1, m + 1, r, pos, val);
  for (int i = 0; i < 60; ++i) {
    int val = tree[i][v + v];
    tree[i][v] = val + tree[(i + val) % 60][v + v + 1];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  build(1, 0, n - 1);
  int Q;
  scanf("%d\n", &Q);
  while (Q--) {
    char q;
    int x, y;
    scanf("%c %d %d\n", &q, &x, &y);
    if (q == 'C') {
      update(1, 0, n - 1, x - 1, y);
    } else {
      int ans = get(1, 0, n - 1, x - 1, y - 2, 0);
      printf("%d\n", ans);
    }
  }
  return 0;
}
