#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101000;
const int MOD = 60;
int maxrt = 0;
int tt[MAXN * 4 + 100][MOD];
void PushUP(int *val, int *lct, int *rct) {
  for (int i = 0; i < MOD; i++) {
    val[i] = lct[i] + rct[(i + lct[i]) % MOD];
  }
}
void insert(int pos, int val, int rt, int l, int r) {
  if (r - l == 1) {
    for (int i = 0; i < MOD; i++) {
      tt[rt][i] = (i % val == 0) ? 2 : 1;
    }
    return;
  }
  int mid = (l + r) / 2;
  if (mid > pos) {
    insert(pos, val, rt * 2 + 1, l, mid);
  } else {
    insert(pos, val, rt * 2 + 2, mid, r);
  }
  PushUP(tt[rt], tt[rt * 2 + 1], tt[rt * 2 + 2]);
}
int query(int ql, int qr, int v, int rt, int l, int r) {
  if (ql <= l && r <= qr) {
    return tt[rt][v];
  }
  int mid = (l + r) / 2;
  int lv = 0, rv = 0;
  if (mid > ql && l < qr) {
    lv = query(ql, qr, v, rt * 2 + 1, l, mid);
  }
  if (mid < qr && r > ql) {
    rv = query(ql, qr, (lv + v) % MOD, rt * 2 + 2, mid, r);
  }
  return lv + rv;
}
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    insert(i, x, 0, 0, n);
  }
  char cmd[10];
  int val[MOD];
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int a, b;
    scanf("%s%d%d", cmd, &a, &b);
    if (cmd[0] == 'C') {
      insert(a - 1, b, 0, 0, n);
    } else {
      printf("%d\n", query(a - 1, b - 1, 0, 0, 0, n));
    }
  }
  return 0;
}
