#include <bits/stdc++.h>
using namespace std;
void merge(int* c, int* a, int* b) {
  int t[60];
  for (int i = 0, ThxDem = 60; i < ThxDem; ++i)
    t[i] = a[i] + b[(i + a[i]) % 60];
  for (int i = 0, ThxDem = 60; i < ThxDem; ++i) c[i] = t[i];
}
int st[400005][60];
void st_upd(int k, int s, int e, int p, int v) {
  if (s + 1 == e) {
    for (int i = 0, ThxDem = 60; i < ThxDem; ++i) st[k][i] = 1 + (i % v == 0);
  } else {
    int m = (s + e) / 2;
    if (p < m)
      st_upd(2 * k, s, m, p, v);
    else
      st_upd(2 * k + 1, m, e, p, v);
    merge(st[k], st[2 * k], st[2 * k + 1]);
  }
}
void st_query(int k, int s, int e, int a, int b, int* r) {
  if (e <= a || s >= b) return;
  if (s >= a && e <= b) {
    merge(r, r, st[k]);
    return;
  }
  int m = (s + e) / 2;
  st_query(2 * k, s, m, a, b, r);
  st_query(2 * k + 1, m, e, a, b, r);
}
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    int a;
    scanf("%d", &a);
    st_upd(1, 0, n, i, a);
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    char _s[4];
    int a, b;
    scanf("%s%d%d", _s, &a, &b);
    if (_s[0] == 'A') {
      a--;
      b--;
      int r[60];
      for (int i = 0, ThxDem = 60; i < ThxDem; ++i) r[i] = 0;
      st_query(1, 0, n, a, b, r);
      printf("%d\n", r[0]);
    } else {
      a--;
      st_upd(1, 0, n, a, b);
    }
  }
  return 0;
}
