#include <bits/stdc++.h>
using namespace std;
int val[100100 << 2][70];
int a[100100];
void push_up(int u) {
  for (int i = 0; i < 60; i++) {
    val[u][i] = val[2 * u][i] + val[2 * u + 1][(i + val[2 * u][i]) % 60];
  }
}
void build(int u, int l, int r) {
  if (l + 1 == r) {
    for (int i = 0; i < 60; i++) val[u][i] = 1 + (i % a[l] == 0);
    return;
  }
  int mid = (l + r) >> 1;
  build(2 * u, l, mid);
  build(2 * u + 1, mid, r);
  push_up(u);
}
void update(int u, int l, int r, int p) {
  if (l + 1 == r) {
    for (int i = 0; i < 60; i++) val[u][i] = 1 + (i % a[l] == 0);
    return;
  }
  int mid = (l + r) >> 1;
  if (p >= mid)
    update(2 * u + 1, mid, r, p);
  else
    update(2 * u, l, mid, p);
  push_up(u);
}
int ans = 0;
void calc(int u, int L, int R, int l, int r) {
  if (l >= R || r <= L) return;
  if (L >= l and R <= r) {
    ans += val[u][ans % 60];
    return;
  }
  int mid = (L + R) >> 1;
  calc(u * 2, L, mid, l, r);
  calc(u * 2 + 1, mid, R, l, r);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int m;
  scanf("%d", &m);
  build(1, 0, n);
  while (m--) {
    char c;
    scanf(" %c", &c);
    int x, y;
    scanf("%d%d", &x, &y);
    if (c == 'C')
      a[x - 1] = y, update(1, 0, n, x - 1);
    else {
      ans = 0;
      calc(1, 0, n, x - 1, y - 1);
      printf("%d\n", ans);
    }
  }
  return 0;
}
