#include <bits/stdc++.h>
const int M = 60;
const int N = 100000 + 5;
struct SegmentTree {
  int t[N << 2][M];
  void up(int rt) {
    for (int i = 0; i < 60; ++i) {
      t[rt][i] = t[rt << 1 | 1][(t[rt << 1][i] + i) % M] + t[rt << 1][i];
    }
  }
  void modify(int p, int dt, int l, int r, int rt) {
    if (l == r) {
      for (int i = 0; i < M; ++i) {
        if (i % dt == 0) {
          t[rt][i] = 2;
        } else {
          t[rt][i] = 1;
        }
      }
      return;
    }
    int mid = l + r >> 1;
    if (p <= mid)
      modify(p, dt, l, mid, rt << 1);
    else
      modify(p, dt, mid + 1, r, rt << 1 | 1);
    up(rt);
  }
  int query(int L, int R, int d, int l, int r, int rt) {
    if (L <= l && r <= R) {
      return d + t[rt][d % M];
    }
    int mid = l + r >> 1;
    if (L <= mid) d = query(L, R, d, l, mid, rt << 1);
    if (mid < R) d = query(L, R, d, mid + 1, r, rt << 1 | 1);
    return d;
  }
} sgt;
int n, m;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    sgt.modify(i, x, 1, n, 1);
  }
  scanf("%d", &m);
  while (m--) {
    char op[2];
    int a, b;
    scanf("%s%d%d", op, &a, &b);
    if (op[0] == 'C') {
      sgt.modify(a, b, 1, n, 1);
    } else {
      printf("%d\n", sgt.query(a, b - 1, 0, 1, n, 1));
    }
  }
  return 0;
}
