#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    X = (X << 3) + (X << 1) + ch - '0', ch = getchar();
  return X * w;
}
const int tmax = 60;
int tree[400001][tmax];
int b[100001];
void build(int a, int l, int r) {
  if (l == r) {
    for (int i = 0; i < tmax; i++) {
      if (i % b[l])
        tree[a][i] = i + 1;
      else
        tree[a][i] = i + 2;
    }
    return;
  }
  int mid = (l + r) >> 1;
  build(a * 2, l, mid);
  build(a * 2 + 1, mid + 1, r);
  for (int i = 0; i < tmax; i++) {
    tree[a][i] =
        tree[a * 2 + 1][tree[a * 2][i] % tmax] + tree[a * 2][i] / tmax * tmax;
  }
  return;
}
int check(int a, int l, int r, int l1, int r1, int t) {
  if (l > r1 || r < l1) return t;
  if (l1 <= l && r <= r1) {
    return tree[a][t % tmax] + t / tmax * tmax;
  }
  int mid = (l + r) >> 1;
  int k1 = check(a * 2, l, mid, l1, r1, t);
  int k2 = check(a * 2 + 1, mid + 1, r, l1, r1, k1);
  return k2;
}
void gai(int a, int l, int r, int x, int y) {
  if (x < l || r < x) return;
  if (l == x && x == r) {
    b[l] = y;
    for (int i = 0; i < tmax; i++) {
      if (i % b[l])
        tree[a][i] = i + 1;
      else
        tree[a][i] = i + 2;
    }
    return;
  }
  int mid = (l + r) >> 1;
  gai(a * 2, l, mid, x, y);
  gai(a * 2 + 1, mid + 1, r, x, y);
  for (int i = 0; i < tmax; i++) {
    tree[a][i] =
        tree[a * 2 + 1][tree[a * 2][i] % tmax] + tree[a * 2][i] / tmax * tmax;
  }
  return;
}
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) {
    b[i] = read();
  }
  build(1, 1, n);
  int q = read();
  for (int i = 1; i <= q; i++) {
    char c;
    cin >> c;
    int x = read();
    int y = read();
    if (c == 'A') {
      printf("%d\n", check(1, 1, n, x, y - 1, 0));
    } else {
      gai(1, 1, n, x, y);
    }
  }
  return 0;
}
