#include <bits/stdc++.h>
std::vector<int> merge(std::vector<int> a, std::vector<int> b) {
  std::vector<int> res(60);
  for (int i = 0; i < 60; ++i) {
    res[i] = a[i] + b[(i + a[i]) % 60];
  }
  return res;
}
const int shift = 1 << 17;
std::vector<std::vector<int> > tree(shift << 1, std::vector<int>(60));
std::vector<int> get(int l, int r) {
  if (l >= r) return std::vector<int>(60, 0);
  if (l % 2) {
    return merge(tree[l], get(l + 1, r));
  }
  if (r % 2) {
    --r;
    return merge(get(l, r), tree[r]);
  }
  return get(l / 2, r / 2);
}
class A {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    std::vector<int> a(n);
    for (int i = 0; i < n; ++i) {
      in >> a[i];
    }
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < 60; ++j) {
        if (j % a[i] == 0)
          tree[i + shift][j] = 2;
        else
          tree[i + shift][j] = 1;
      }
    }
    for (int i = shift - 1; i; --i) {
      tree[i] = merge(tree[2 * i], tree[2 * i + 1]);
    }
    int m;
    in >> m;
    for (int it = 0; it < m; ++it) {
      char c;
      int x, y;
      in >> c >> x >> y;
      if (c == 'C') {
        --x;
        a[x] = y;
        int i = x;
        for (int j = 0; j < 60; ++j) {
          if (j % a[i] == 0)
            tree[i + shift][j] = 2;
          else
            tree[i + shift][j] = 1;
        }
        i += shift;
        i /= 2;
        while (i) {
          tree[i] = merge(tree[2 * i], tree[2 * i + 1]);
          i /= 2;
        }
      } else {
        --x, --y;
        out << get(x + shift, y + shift)[0] << "\n";
      }
    }
  }
};
int main() {
  std::cin.sync_with_stdio(false);
  std::cin.tie(0);
  std::cout << std::fixed;
  std::cout.precision(20);
  A solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
