#include <bits/stdc++.h>
using namespace std;
int n;
int a[211111];
int dp[211111][60];
const int C = 80;
void calc(int l, int r) {
  for (int i = r - 1; i >= l; i--) {
    if (i == r - 1) {
      int o = 0;
      for (int j = 0; j < 59; j++) {
        if (o == 0) {
          dp[i][j] = 2;
        } else {
          dp[i][j] = 1;
        }
        o++;
        if (o == a[i]) o = 0;
      }
      if (o == 0) {
        dp[i][59] = 2;
      } else {
        dp[i][59] = 1;
      }
      continue;
    }
    int o = 0;
    for (int j = 0; j < 59; j++) {
      if (o == 0) {
        dp[i][j] = 2 + dp[i + 1][(j + 2) % 60];
      } else {
        dp[i][j] = 1 + dp[i + 1][j + 1];
      }
      o++;
      if (o == a[i]) o = 0;
    }
    if (o == 0) {
      dp[i][59] = 2 + dp[i + 1][1];
    } else {
      dp[i][59] = 1 + dp[i + 1][0];
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i <= n; i += C) calc(i, min(i + C, n));
  int t;
  scanf("%d\n", &t);
  while (t--) {
    char type;
    scanf("%c", &type);
    if (type == 'C') {
      int x, v;
      scanf("%d%d\n", &x, &v);
      x--;
      a[x] = v;
      calc(x / C * C, min(x / C * C + C, n));
    } else {
      int x, y;
      scanf("%d%d\n", &x, &y);
      x--;
      y--;
      int t = 0;
      while (x % C != 0 && x < y) {
        if (t % a[x] == 0) t++;
        t++;
        x++;
      }
      while (x < y && min(x + C, n) <= y) {
        int g = dp[x][t % 60];
        t += g;
        x = min(x + C, n);
      }
      while (x < y) {
        if (t % a[x] == 0) t++;
        t++;
        x++;
      }
      printf("%d\n", t);
    }
  }
  return 0;
}
