#include <bits/stdc++.h>
using namespace std;
const int maxN = 100 * 1000 + 2;
const int mod = 1000 * 1000 * 1000 + 7;
int seg[60][4 * maxN];
int a[maxN];
void make(int ind, int s, int e) {
  if (e - s == 1) {
    for (int i = 0; i < 60; i++)
      if (i % a[s] == 0)
        seg[i][ind] = 2;
      else
        seg[i][ind] = 1;
    return;
  }
  int mid = (s + e) >> 1;
  make(2 * ind + 0, s, mid);
  make(2 * ind + 1, mid, e);
  for (int i = 0; i < 60; i++) {
    int tmp = (seg[i][2 * ind] + i) % 60;
    seg[i][ind] = seg[tmp][2 * ind + 1] + seg[i][2 * ind];
  }
}
void mof(int p, int val, int s, int e, int ind) {
  if (e - s == 1) {
    for (int i = 0; i < 60; i++)
      if (i % val == 0)
        seg[i][ind] = 2;
      else
        seg[i][ind] = 1;
    return;
  }
  int mid = (s + e) >> 1;
  if (p < mid)
    mof(p, val, s, mid, 2 * ind);
  else
    mof(p, val, mid, e, 2 * ind + 1);
  for (int i = 0; i < 60; i++) {
    int tmp = (seg[i][2 * ind] + i) % 60;
    seg[i][ind] = seg[tmp][2 * ind + 1] + seg[i][2 * ind];
  }
}
int get(int l, int r, int ti, int s, int e, int ind) {
  if (l >= e || r <= s) return ti;
  if (l <= s && e <= r) {
    return ti + seg[ti % 60][ind];
  }
  int mid = (s + e) >> 1;
  ti = get(l, r, ti, s, mid, 2 * ind + 0);
  ti = get(l, r, ti, mid, e, 2 * ind + 1);
  return ti;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  make(1, 0, n);
  int m;
  cin >> m;
  while (m--) {
    char c;
    int x, y;
    cin >> c >> x >> y;
    x--;
    if (c == 'A') {
      y--;
      cout << get(x, y, 0, 0, n, 1) << endl;
      continue;
    }
    mof(x, y, 0, n, 1);
  }
  return 0;
}
