#include <bits/stdc++.h>
using namespace std;
const int maxN = 101000;
int t[4 * maxN][60];
int a[maxN];
int get(int v, int cl, int cr, int l, int r, int mod) {
  if (cl == l && cr == r) {
    return t[v][mod];
  }
  int mid = (cl + cr) / 2;
  if (r <= mid) {
    return get(2 * v, cl, mid, l, r, mod);
  } else if (l > mid) {
    return get(2 * v + 1, mid + 1, cr, l, r, mod);
  } else {
    int v1 = get(2 * v, cl, mid, l, mid, mod);
    int v2 = get(2 * v + 1, mid + 1, cr, mid + 1, r, (mod + v1) % 60);
    return v1 + v2;
  }
}
void update(int v, int cl, int cr, int ps, int value) {
  if (cl == cr) {
    for (int i = 0; i < 60; ++i) {
      if (i % value == 0) {
        t[v][i] = 2;
      } else {
        t[v][i] = 1;
      }
    }
    return;
  }
  int mid = (cl + cr) / 2;
  if (ps <= mid) {
    update(2 * v, cl, mid, ps, value);
  } else {
    update(2 * v + 1, mid + 1, cr, ps, value);
  }
  for (int i = 0; i < 60; ++i) {
    int v1 = t[2 * v][i];
    int v2 = t[2 * v + 1][(i + v1) % 60];
    t[v][i] = v1 + v2;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    update(1, 1, n, i, a[i]);
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int x, y;
    string cur;
    cin >> cur;
    if (cur == "A") {
      cin >> x >> y;
      --y;
      cout << get(1, 1, n, x, y, 0) << endl;
    } else if (cur == "C") {
      cin >> x >> y;
      update(1, 1, n, x, y);
    }
  }
  return 0;
}
