#include <bits/stdc++.h>
using namespace std;
int n;
int c[100005 * 4][63], a[100005], qk, qw, ql, qr, ans;
void push_up(int o) {
  for (int i = 0; i < 60; i++) {
    int x = c[o << 1][i] + 1;
    c[o][i] = x + c[o << 1 | 1][(x + i) % 60];
  }
}
void build_tree(int o, int L, int R) {
  int i;
  if (L == R) {
    for (i = 0; i < 60; i++)
      if (i % a[L] == 0)
        c[o][i] = 1;
      else
        c[o][i] = 0;
    return;
  }
  int mid = (L + R) >> 1;
  build_tree(o << 1, L, mid);
  build_tree(o << 1 | 1, mid + 1, R);
  push_up(o);
}
void Change(int o, int L, int R) {
  if (L == R) {
    for (int i = 0; i < 60; i++)
      if (i % a[L] == 0)
        c[o][i] = 1;
      else
        c[o][i] = 0;
    return;
  }
  int mid = (L + R) >> 1;
  if (qk <= mid)
    Change(o << 1, L, mid);
  else
    Change(o << 1 | 1, mid + 1, R);
  push_up(o);
}
void Query(int o, int L, int R) {
  if (L >= ql && R <= qr) {
    ans = ans + c[o][ans % 60] + 1;
    return;
  }
  int mid = (L + R) >> 1;
  if (ql <= mid) Query(o << 1, L, mid);
  if (qr > mid) Query(o << 1 | 1, mid + 1, R);
}
char op[2];
int main() {
  int i, m;
  cin >> n;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  build_tree(1, 1, n);
  cin >> m;
  while (m--) {
    scanf("%s", op);
    if (op[0] == 'C') {
      scanf("%d%d", &qk, &qw);
      a[qk] = qw;
      Change(1, 1, n);
    } else {
      scanf("%d%d", &ql, &qr);
      qr--;
      ans = 0;
      Query(1, 1, n);
      printf("%d\n", ans);
    }
  }
  return 0;
}
