#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n;
int a[N];
int res = 0;
struct it {
  int tree[N * 4][60];
  void build(int node, int l, int r) {
    if (l == r) {
      for (int i = 0; i <= 59; i++) {
        tree[node][i] = 1 + ((i % a[l]) == 0);
      }
    } else {
      int m = (l + r) >> 1;
      build(node * 2, l, m);
      build(node * 2 + 1, m + 1, r);
      for (int i = 0; i <= 59; i++) {
        int f = tree[node * 2][i];
        tree[node][i] = f + tree[node * 2 + 1][(i + f) % 60];
      }
    }
  }
  void query(int node, int l, int r, int x, int y) {
    if (x > r || y < l) {
      return;
    }
    if (x <= l && r <= y) {
      res += tree[node][res % 60];
      return;
    }
    int m = (l + r) / 2;
    query(node * 2, l, m, x, y);
    query(node * 2 + 1, m + 1, r, x, y);
  }
  void update(int node, int l, int r, int x, int y) {
    if (l > x || r < x) {
      return;
    }
    if (l == r) {
      for (int i = 0; i <= 59; i++) {
        tree[node][i] = 1 + ((i % y) == 0);
      }
      return;
    }
    int m = (l + r) >> 1;
    update(node * 2, l, m, x, y);
    update(node * 2 + 1, m + 1, r, x, y);
    for (int i = 0; i <= 59; i++) {
      int f = tree[node * 2][i];
      tree[node][i] = f + tree[node * 2 + 1][(i + f) % 60];
    }
  }
} t;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  t.build(1, 1, n);
  int q;
  scanf("%d", &q);
  while (q--) {
    char type;
    int x, y;
    cin >> type;
    scanf("%d %d", &x, &y);
    if (type == 'A') {
      res = 0;
      t.query(1, 1, n, x, y - 1);
      printf("%d\n", res);
    } else {
      t.update(1, 1, n, x, y);
    }
  }
  return 0;
}
