#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int MAX = 60;
int a[N], dp[N], n;
void move(int &tt, int &ind) {
  tt += (tt % a[ind]) ? 1 : 2;
  ++ind;
}
int sol(int i) {
  int t = 0;
  while (t < MAX && i <= n) move(t, i);
  return i;
}
char c[5];
int main() {
  int x, y, q, pos, i, j;
  cin >> n;
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (i = 1; i <= n; ++i) dp[i] = sol(i);
  cin >> q;
  while (q--) {
    scanf("%s%d%d", c, &x, &y);
    if (c[0] == 'A') {
      int ret = 0;
      while (dp[x] < y) ret += MAX, x = dp[x];
      while (x < y) move(ret, x);
      printf("%d\n", ret);
    } else {
      a[x] = y;
      for (j = x - 1; j > 0 && dp[j] >= x; --j) dp[j] = sol(j);
    }
  }
}
