#include <bits/stdc++.h>
using namespace std;
const int lcm = 60;
class segment_tree {
 private:
  int tree[((1 << 18) + 10)][62];
  int X[100010];
  inline int left(int x) { return (x << 1) + 1; }
  inline int right(int x) { return (x << 1) + 2; }
  int merge(int node, int s, int e, int t) {
    int m, l, r;
    l = left(node);
    r = right(node);
    m = (s + e) >> 1;
    int time = t;
    time += tree[l][time % lcm];
    time += !(time % X[m]);
    ++time;
    time += tree[r][time % lcm];
    return time - t;
  }
  void init(int node, int s, int e, int *A) {
    int i;
    if (s == e) {
      X[s] = A[s];
      for (i = 0; i < lcm; ++i) tree[node][i] = 0;
      return;
    }
    init(left(node), s, (s + e) >> 1, A);
    init(right(node), ((s + e) >> 1) + 1, e, A);
    for (i = 0; i < lcm; ++i) {
      tree[node][i] = merge(node, s, e, i);
    }
  }
  int query(int node, int s, int e, int i, int j, int time) {
    if (s > j || e < i) return time;
    if (s >= i && e <= j) {
      return time + tree[node][time % lcm];
    }
    int l = left(node), r = right(node), m = (s + e) >> 1;
    time = query(l, s, m, i, j, time);
    if (m >= j) return time;
    if (m >= i) {
      time += !(time % X[m]);
      ++time;
    }
    return query(r, m + 1, e, i, j, time);
  }
  void update(int node, int s, int e, int i) {
    if (s > i || e < i) return;
    if (s == i && e == i) return;
    update(left(node), s, (s + e) >> 1, i);
    update(right(node), ((s + e) >> 1) + 1, e, i);
    int k;
    for (k = 0; k < lcm; ++k) {
      tree[node][k] = merge(node, s, e, k);
    }
  }
  int N;

 public:
  void init(int n, int *A) {
    N = n;
    init(0, 0, N - 1, A);
  }
  int query(int i, int j) { return query(0, 0, N - 1, i, j, 0); }
  void update(int i, int val) {
    X[i] = val;
    update(0, 0, N - 1, i);
  }
};
int N, Q;
int A[100010];
segment_tree T;
int main() {
  ios_base::sync_with_stdio(0);
  int i, x, y;
  char c;
  cin >> N;
  for (i = 0; i < N; ++i) cin >> A[i];
  A[N++] = 6;
  T.init(N, A);
  cin >> Q;
  while (Q--) {
    cin >> c >> x >> y;
    if (c ^ 'C') {
      cout << T.query(x - 1, y - 1) << '\n';
      continue;
    }
    --x;
    A[x] = y;
    T.update(x, y);
  }
  return 0;
}
