#include <bits/stdc++.h>
using namespace std;
const int M = 400010, mod = 1000000007;
int T[M][62];
int A[M];
void merhe(int i, int l, int r) {
  for (int t = 0; t <= 60; t++) {
    T[i][t] = T[l][t] + T[r][(t + T[l][t]) % 60];
  }
}
void build(int i, int l, int r) {
  if (l == r) {
    for (int t = 0; t <= 60; t++) {
      if (t % A[l] == 0)
        T[i][t] = 2;
      else
        T[i][t] = 1;
    }
  } else {
    int m = (l + r) / 2;
    build((2 * i), l, m);
    build((2 * i + 1), m + 1, r);
    merhe(i, (2 * i), (2 * i + 1));
  }
}
void update(int i, int l, int r, int first, int val) {
  if (l == r && r == first) {
    A[l] = val;
    for (int t = 0; t <= 60; t++) {
      if (t % A[l] == 0)
        T[i][t] = 2;
      else
        T[i][t] = 1;
    }
  } else if (l <= first && first <= r) {
    int m = (l + r) / 2;
    update((2 * i), l, m, first, val);
    update((2 * i + 1), m + 1, r, first, val);
    merhe(i, (2 * i), (2 * i + 1));
  }
}
int TIME;
void query(int i, int l, int r, int st, int ed) {
  if (l >= st && r <= ed) {
    TIME = TIME + T[i][TIME % 60];
  } else if (l > ed || r < st)
    return;
  else {
    int m = (l + r) / 2;
    query((2 * i), l, m, st, ed);
    query((2 * i + 1), m + 1, r, st, ed);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, q, l, r;
  int i, j, k;
  char t[10];
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &A[i]);
  build(1, 1, n);
  scanf("%d", &q);
  while (q--) {
    scanf("%s", t);
    scanf("%d%d", &l, &r);
    if (t[0] == 'C') {
      update(1, 1, n, l, r);
    } else {
      TIME = 0;
      query(1, 1, n, l, r - 1);
      printf("%d\n", TIME);
    }
  }
  return 0;
}
