#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int n;
int a[maxn];
int tot[maxn << 2][60];
void up(int x) {
  for (int i = 0; i < 60; i++) {
    tot[x][i] = tot[x + x][i] + tot[x + x + 1][(i + tot[x + x][i]) % 60];
  }
}
void build(int x, int l, int r) {
  if (l == r) {
    for (int i = 0; i < 60; i++)
      if (i % a[l])
        tot[x][i] = 1;
      else
        tot[x][i] = 2;
  } else {
    int y = (l + r) >> 1;
    build(x + x, l, y);
    build(x + x + 1, y + 1, r);
    up(x);
  }
}
void put(int x, int l, int r, int p, int v) {
  if (l == r) {
    a[l] = v;
    for (int i = 0; i < 60; i++)
      if (i % a[l])
        tot[x][i] = 1;
      else
        tot[x][i] = 2;
    return;
  }
  int y = (l + r) >> 1;
  if (p <= y)
    put(x + x, l, y, p, v);
  else
    put(x + x + 1, y + 1, r, p, v);
  up(x);
}
int curTime[60];
void query(int x, int l, int r, int ll, int rr) {
  if (ll <= l && r <= rr) {
    for (int i = 0; i < 60; i++) curTime[i] = tot[x][i];
    return;
  }
  int y = (l + r) >> 1;
  if (ll <= y && y < rr) {
    query(x + x, l, y, ll, rr);
    int temp1[60], temp2[60];
    memcpy(temp1, curTime, sizeof curTime);
    query(x + x + 1, y + 1, r, ll, rr);
    memcpy(temp2, curTime, sizeof curTime);
    for (int i = 0; i < 60; i++)
      curTime[i] = temp1[i] + temp2[(i + temp1[i]) % 60];
  } else if (ll <= y) {
    query(x + x, l, y, ll, rr);
  } else {
    query(x + x + 1, y + 1, r, ll, rr);
  }
}
int main(int argc, char *argv[]) {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  build(1, 1, n);
  int q;
  cin >> q;
  while (q--) {
    char op[10];
    int x, y;
    scanf("%s%d%d", op, &x, &y);
    if (op[0] == 'A') {
      query(1, 1, n, x, y - 1);
      printf("%d\n", curTime[0]);
    } else {
      put(1, 1, n, x, y);
    }
  }
  return 0;
}
