#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int K = 65;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;
int n, a[N], q;
int t[4 * N][K];
void build(int v, int s, int e) {
  if (s == e) {
    for (int i = 0; i < 60; i++) {
      if (i % a[s] == 0)
        t[v][i] = 2;
      else
        t[v][i] = 1;
    }
    return;
  }
  int m = (s + e) / 2;
  build(2 * v, s, m);
  build(2 * v + 1, m + 1, e);
  for (int i = 0; i < 60; i++) {
    int x = (i + t[2 * v][i]) % 60;
    t[v][i] = t[2 * v][i] + t[2 * v + 1][x];
  }
}
void update(int v, int s, int e, int pos) {
  if (s == e) {
    for (int i = 0; i < 60; i++) {
      if (i % a[s] == 0)
        t[v][i] = 2;
      else
        t[v][i] = 1;
    }
    return;
  }
  int m = (s + e) / 2;
  if (pos <= m)
    update(2 * v, s, m, pos);
  else
    update(2 * v + 1, m + 1, e, pos);
  for (int i = 0; i < 60; i++) {
    int x = (i + t[2 * v][i]) % 60;
    t[v][i] = t[2 * v][i] + t[2 * v + 1][x];
  }
}
int get(int v, int s, int e, int l, int r, int st) {
  if (l > r) return -1;
  if (s == l && e == r) return t[v][st];
  int m = (s + e) / 2;
  int answ = 0;
  int T = get(2 * v, s, m, l, min(r, m), st);
  if (T == -1)
    T = st;
  else {
    answ += T;
    T += st;
  }
  int P = get(2 * v + 1, m + 1, e, max(m + 1, l), r, T % 60);
  if (P != -1) answ += P;
  return answ;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  a[n + 1] = 1;
  build(1, 1, n + 1);
  scanf("%d", &q);
  while (q--) {
    char x;
    int aa, b;
    cin >> x;
    scanf("%d%d", &aa, &b);
    if (x == 'A') {
      int T = get(1, 1, n + 1, aa, b - 1, 0);
      printf("%d\n", T);
    } else {
      a[aa] = b;
      update(1, 1, n + 1, aa);
    }
  }
  return 0;
}
