#include <bits/stdc++.h>
using namespace std;
int q, n, m, a[100001];
vector<int> t[600001];
vector<int> merge(vector<int> v1, vector<int> v2) {
  vector<int> p;
  if (!v1.size()) v1.resize(60);
  if (!v2.size()) v2.resize(60);
  for (int k = 0; k < 60; ++k) {
    int t1 = v1[k];
    t1 += v2[(k + t1) % 60];
    p.push_back(t1);
  }
  return p;
}
void upd(int v, int l, int r, int pos, int tt) {
  if (l == r) {
    t[v].resize(60);
    for (int k = 0; k < 60; k++) {
      t[v][k] = 1 + ((k % tt) == 0);
    }
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    upd(v + v, l, mid, pos, tt);
  else
    upd(v + v + 1, mid + 1, r, pos, tt);
  for (int k = 0; k < 60; ++k) {
    int t1 = t[2 * v][k];
    t1 += t[2 * v + 1][(k + t1) % 60];
    t[v][k] = t1;
  }
  return;
}
int tim = 0;
int get(int v, int l, int r, int l1, int r1) {
  if (l > r1 || r < l1) return 0;
  if (l == l1 && r == r1) {
    if (!t[v].size()) t[v].resize(60);
    int yy = tim;
    tim = tim + t[v][yy % 60];
    return t[v][yy % 60];
  }
  int mid = (l + r) >> 1;
  int A, B;
  A = get(v + v, l, mid, l1, min(r1, mid));
  B = get(v + v + 1, mid + 1, r, max(mid + 1, l1), r1);
  return A + B;
}
void build(int v, int l, int r) {
  if (l == r) {
    t[v].resize(60, 0);
    for (int k = 0; k < 60; ++k) {
      t[v][k] = 1;
      if ((k % a[l]) == 0) ++t[v][k];
    }
    return;
  }
  int mid = (l + r) / 2;
  build(2 * v, l, mid);
  build(2 * v + 1, mid + 1, r);
  t[v] = merge(t[2 * v], t[2 * v + 1]);
  return;
}
int main() {
  scanf("%d", &n);
  ;
  for (int k = 1; k <= n; ++k) {
    scanf("%d", &a[k]);
    ;
  }
  build(1, 1, n);
  scanf("%d", &q);
  ;
  while (q--) {
    char op;
    int x, y;
    scanf("%c", &op);
    scanf("%c", &op);
    scanf("%d", &x);
    ;
    scanf("%d", &y);
    ;
    if (op == 'C') {
      upd(1, 1, n, x, y);
      continue;
    }
    tim = 0;
    int ans = get(1, 1, n, x, y - 1);
    printf("%d\n", tim);
    ;
  }
  return 0;
}
