#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int M = 60;
const int inf = 1e9 + 7;
const long long base = 1e18;
const double pi = acos(-1);
const double ep = 1e-18;
int seg[M][N * 3];
int n;
void update(int i, int l, int r, int u, int x) {
  if (l == u && r == u) {
    for (int j = 0; j < M; j++) {
      if (j % x == 0)
        seg[j][i] = 2;
      else
        seg[j][i] = 1;
    }
    return;
  }
  int g = (l + r) >> 1, next = i << 1;
  if (u <= g)
    update(next, l, g, u, x);
  else
    update(next + 1, g + 1, r, u, x);
  for (int j = 0; j < M; j++) {
    int tmp = seg[j][next];
    seg[j][i] = tmp + seg[(j + tmp) % 60][next + 1];
  }
  return;
}
int get(int i, int l, int r, int u, int v, int first) {
  if (l == u && r == v) {
    return seg[first % 60][i];
  }
  int g = (l + r) >> 1, next = i << 1;
  int res = 0;
  if (u <= g) res += get(next, l, g, u, min(g, v), first);
  if (g < v) {
    if (u <= g) first = (first + res) % M;
    res += get(next + 1, g + 1, r, max(u, g + 1), v, first);
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) {
    int u;
    scanf("%d", &u);
    update(1, 1, n, i, u);
  }
  int query;
  cin >> query;
  while (query-- > 0) {
    char c;
    int u, v;
    cin >> c >> u >> v;
    if (c == 'C') {
      update(1, 1, n, u, v);
    } else {
      printf("%d\n", get(1, 1, n, u, v - 1, 0));
    }
  }
  return 0;
}
