#include <bits/stdc++.h>
using namespace std;
static int m1[3 * (1 << 17)][60], m2[2 * (1 << 17)];
inline void up(int n) {
  if (n >= (1 << 17)) return;
  for (int i = 59; i >= 0; --i) {
    m1[n][i] = m1[n * 2][i] + m1[n * 2 + 1][(i + m1[n * 2][i]) % 60];
  }
}
void in(int v, int d) {
  d += (1 << 17);
  for (int i = 0; i < 60; ++i)
    if (i % v == 0)
      m1[d][i] = 2;
    else
      m1[d][i] = 1;
  for (int i = d; i > 0; i /= 2) up(i);
}
int gt(int cu, int l, int r, int lx, int rx, int mo) {
  if (lx >= r || l >= rx) return 0;
  if (lx <= l && rx >= r) {
    return m1[cu][mo];
  }
  int a = gt(cu * 2, l, (l + r) / 2, lx, rx, mo);
  return a + gt(cu * 2 + 1, (l + r) / 2, r, lx, rx, (a + mo) % 60);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, a, b, m;
  char ch;
  scanf("%i", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%i", &m2[i]);
    in(m2[i], i + 1);
  }
  scanf("%i\n", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%c%i%i\n", &ch, &a, &b);
    if (ch == 'A')
      printf("%i\n", gt(1, 0, (1 << 17), a, b, 0));
    else
      in(b, a);
  }
  return 0;
}
