#include <bits/stdc++.h>
using namespace std;
int n, q, x, y, a[100005], St[65][100005 * 4];
char c;
void up(int node, int bas, int son, int x, int y, int val) {
  if (bas > y || son < x) return;
  if (bas >= x && son <= y) {
    a[bas] = val;
    for (int i = 0; i < 60; i++) {
      St[i][node] = (i % a[bas] == 0) + 1;
    }
    return;
  }
  up(node * 2, bas, ((bas + son) / 2), x, y, val);
  up(node * 2 + 1, ((bas + son) / 2) + 1, son, x, y, val);
  for (int i = 0; i < 60; i++) {
    St[i][node] =
        St[i][node * 2] + St[(St[i][node * 2] + i) % 60][node * 2 + 1];
  }
}
int get(int node, int bas, int son, int x, int y, int tim) {
  if (bas > y || son < x) return 0;
  if (bas >= x && son <= y) return St[tim][node];
  int res1 = get(node * 2, bas, ((bas + son) / 2), x, y, tim);
  return res1 +
         get(node * 2 + 1, ((bas + son) / 2) + 1, son, x, y, (tim + res1) % 60);
}
void build(int node, int bas, int son) {
  if (bas == son) {
    for (int i = 0; i < 60; i++) {
      St[i][node] = (i % a[bas] == 0) + 1;
    }
    return;
  }
  build(node * 2, bas, ((bas + son) / 2));
  build(node * 2 + 1, ((bas + son) / 2) + 1, son);
  for (int i = 0; i < 60; i++) {
    St[i][node] =
        St[i][node * 2] + St[(St[i][node * 2] + i) % 60][node * 2 + 1];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  build(1, 1, n);
  scanf("%d", &q);
  while (q--) {
    scanf(" %c %d %d", &c, &x, &y);
    if (c == 'A') {
      printf("%d\n", get(1, 1, n, x, y - 1, 0));
    } else {
      up(1, 1, n, x, x, y);
    }
  }
}
