#include <bits/stdc++.h>
using namespace std;
int seg[66][4 * 100000 + 10];
void insert(int indx, int st, int ed, int pos, int val) {
  if (st == ed) {
    for (int i = 0; i < 60; i++) seg[i][indx] = (i % val) ? 1 : 2;
    return;
  }
  int mid = (st + ed) / 2, L = indx * 2, R = L + 1;
  if (pos <= mid)
    insert(L, st, mid, pos, val);
  else
    insert(R, mid + 1, ed, pos, val);
  for (int i = 0; i < 60; i++)
    seg[i][indx] = seg[i][L] + seg[(i + seg[i][L]) % 60][R];
}
int query(int indx, int st, int ed, int s, int e, int time) {
  if (s == st && e == ed) return seg[time % 60][indx];
  int mid = (st + ed) / 2, L = indx * 2, R = L + 1;
  if (e <= mid)
    return query(L, st, mid, s, e, time);
  else if (s > mid)
    return query(R, mid + 1, ed, s, e, time);
  else {
    int x = query(L, st, mid, s, mid, time);
    int y = query(R, mid + 1, ed, mid + 1, e, time + x);
    return x + y;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    insert(1, 1, n, i, a);
  }
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    char com[5];
    int a, b;
    scanf("%s%d%d", com, &a, &b);
    if (com[0] == 'C')
      insert(1, 1, n, a, b);
    else
      printf("%d\n", query(1, 1, n, a, b - 1, 0));
  }
  return 0;
}
