#include <bits/stdc++.h>
using namespace std;
int n;
int tree[4 * 100010][61];
void leafup(int ind, int a) {
  for (int i = 0; i < 60; ++i) {
    if (i % a == 0)
      tree[ind][i] = 2;
    else
      tree[ind][i] = 1;
  }
}
void nodeup(int ind) {
  for (int i = 0; i < 60; ++i) {
    int x = tree[2 * ind][i];
    int j = (i + x) % 60;
    tree[ind][i] = x + tree[2 * ind + 1][j];
  }
}
void build(int ind, int lo, int hi) {
  if (lo == hi) {
    int a;
    cin >> a;
    leafup(ind, a);
    return;
  }
  int mid = (lo + hi) >> 1;
  build(2 * ind, lo, mid);
  build(2 * ind + 1, mid + 1, hi);
  nodeup(ind);
}
void update(int ind, int lo, int hi, int arrind, int val) {
  if (lo == hi) {
    leafup(ind, val);
    return;
  }
  int mid = (lo + hi) >> 1;
  if (arrind <= mid)
    update(2 * ind, lo, mid, arrind, val);
  else
    update(2 * ind + 1, mid + 1, hi, arrind, val);
  nodeup(ind);
}
int query(int ind, int lo, int hi, int x, int y, int time) {
  if (lo > y or hi < x) return 0;
  if (lo >= x and hi <= y) return tree[ind][time];
  int mid = (lo + hi) >> 1;
  int q1 = query(2 * ind, lo, mid, x, y, time);
  int t2 = (q1 + time) % 60;
  return q1 + query(2 * ind + 1, mid + 1, hi, x, y, t2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  build(1, 0, n - 1);
  int q;
  cin >> q;
  while (q--) {
    char c;
    int x, y;
    cin >> c >> x >> y;
    if (c == 'A') {
      cout << query(1, 0, n - 1, x - 1, y - 2, 0) << "\n";
    } else
      update(1, 0, n - 1, x - 1, y);
  }
  return 0;
}
