#include <bits/stdc++.h>
const int N = 100005;
const int M = 60;
int n, m, a[N], f[N];
void move(int& t, int& x) {
  t += (t % a[x]) ? 1 : 2;
  x++;
}
int go(int x) {
  int t = 0;
  while ((t < M) && (x <= n)) move(t, x);
  return x;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) f[i] = go(i);
  scanf("%d", &m);
  while (m--) {
    int x, y;
    char ord[5];
    scanf("%s%d%d", ord, &x, &y);
    if (ord[0] == 'A') {
      int ans = 0;
      while (f[x] < y) {
        ans += M;
        x = f[x];
      }
      while (x < y) move(ans, x);
      printf("%d\n", ans);
    } else {
      a[x] = y;
      for (int i = x; (i > 0) && (f[i] >= x); i--) f[i] = go(i);
    }
  }
  return 0;
}
