#include <bits/stdc++.h>
using namespace std;
int n, p = 1, q;
int a[100005];
int seg[300005][60];
void fix(int at) {
  for (int j = 0; j < 60; j++) {
    int x = seg[2 * at][j];
    seg[at][j] = seg[2 * at + 1][(x + j) % 60] + x;
  }
}
void update(int at, int lo, int hi, int x) {
  if (hi < x || lo > x) return;
  if (hi == lo) {
    for (int j = 0; j < 60; j++) {
      seg[at][j] = 1 + (j % a[x] == 0);
    }
  } else {
    update(2 * at, lo, (lo + hi) / 2, x);
    update(2 * at + 1, (lo + hi + 1) / 2, hi, x);
    fix(at);
  }
}
int go(int at, int lo, int hi, int qlo, int qhi, int t) {
  if (hi < qlo || qhi < lo) return t;
  if (qlo <= lo && hi <= qhi) {
    return t + seg[at][t % 60];
  }
  int t1 = go(2 * at, lo, (lo + hi) / 2, qlo, qhi, t);
  return go(2 * at + 1, (lo + hi) / 2 + 1, hi, qlo, qhi, t1);
}
int main() {
  scanf("%d", &n);
  while (p < n) p *= 2;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; j < 60; j++) {
      seg[i + p][j] = 1 + (j % a[i] == 0);
    }
  }
  for (int i = p - 1; i >= 1; i--) {
    fix(i);
  }
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    char s[10];
    int x, y;
    scanf("%s %d %d", s, &x, &y);
    if (s[0] == 'C') {
      x--;
      a[x] = y;
      update(1, 0, p - 1, x);
    } else {
      x--;
      y--;
      printf("%d\n", go(1, 0, p - 1, x, y - 1, 0));
    }
  }
}
