#include <bits/stdc++.h>
using namespace std;
int value[100005];
int AI[60][4 * 100005];
void build(int node, int left, int right) {
  int m = (left + right) / 2;
  if (left == right) {
    for (int i = 0; i < 60; i++) {
      if (i % value[left] == 0)
        AI[i][node] = 2;
      else
        AI[i][node] = 1;
    }
    return;
  }
  build(node * 2, left, m);
  build(node * 2 + 1, m + 1, right);
  for (int i = 0; i < 60; i++) {
    int s = AI[i][node * 2];
    s += AI[(i + s) % 60][node * 2 + 1];
    AI[i][node] = s;
  }
}
void update(int node, int left, int right, int position) {
  int m = (left + right) / 2;
  if (left == right) {
    for (int i = 0; i < 60; i++) {
      if (i % value[left] == 0)
        AI[i][node] = 2;
      else
        AI[i][node] = 1;
    }
    return;
  }
  if (m >= position)
    update(node * 2, left, m, position);
  else
    update(node * 2 + 1, m + 1, right, position);
  for (int i = 0; i < 60; i++) {
    int s = AI[i][node * 2];
    s += AI[(i + s) % 60][node * 2 + 1];
    AI[i][node] = s;
  }
}
int query(int node, int left, int right, int a, int b, int start) {
  int m = (left + right) / 2, total = 0;
  if (a <= left && b >= right) return AI[start][node];
  if (m >= a) total = query(node * 2, left, m, a, b, start);
  if (m < b)
    total += query(node * 2 + 1, m + 1, right, a, b, (start + total) % 60);
  return total;
}
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> value[i];
  build(1, 1, N);
  int t;
  cin >> t;
  while (t--) {
    char ch;
    int x, y;
    cin >> ch >> x >> y;
    if (ch == 'C') {
      value[x] = y;
      update(1, 1, N, x);
    } else
      cout << query(1, 1, N, x, y - 1, 0) << "\n";
  }
}
