#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int a[100010];
struct node {
  int v[60];
} t[100010 << 2];
void up(int p) {
  for (int i = 0; i < 60; i++) {
    int first = t[p << 1].v[i];
    int second = (i + first) % 60;
    t[p].v[i] = first + t[p << 1 | 1].v[second];
  }
}
void build(int p, int l, int r) {
  for (int i = 0; i < 60; i++) t[p].v[i] = 0;
  if (l == r) {
    for (int i = 0; i < 60; i++) {
      int j = i, k = 0;
      while (j % a[l] == 0) k++, j++;
      t[p].v[i] = k + 1;
    }
    return;
  }
  int m = (l + r) >> 1;
  build(p << 1, l, m);
  build(p << 1 | 1, m + 1, r);
  up(p);
}
void upd(int p, int l, int r, int first, int second) {
  if (l == r) {
    for (int i = 0; i < 60; i++) {
      int j = i, k = 0;
      while (j % second == 0) k++, j++;
      t[p].v[i] = k + 1;
    }
    return;
  }
  int m = (l + r) >> 1;
  if (first <= m)
    upd(p << 1, l, m, first, second);
  else
    upd(p << 1 | 1, m + 1, r, first, second);
  up(p);
}
int query(int p, int l, int r, int first, int second, int k) {
  if (l >= first && r <= second) return t[p].v[k];
  int m = (l + r) >> 1, ans = 0;
  if (second <= m) return query(p << 1, l, m, first, second, k);
  if (first > m) return query(p << 1 | 1, m + 1, r, first, second, k);
  int res = query(p << 1, l, m, first, m, k);
  ans = res;
  res = (k + res) % 60;
  ans += query(p << 1 | 1, m + 1, r, m + 1, second, res);
  return ans;
}
int main() {
  int i, j, k, ca = 0, m, n;
  while (~scanf("%d", &n)) {
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    build(1, 0, n - 1);
    scanf("%d", &m);
    while (m--) {
      char s[2];
      int first, second;
      scanf("%s%d%d", s, &first, &second);
      if (s[0] == 'C') {
        first--;
        upd(1, 0, n - 1, first, second);
      } else {
        first--, second -= 2;
        int ans = query(1, 0, n - 1, first, second, 0);
        printf("%d\n", ans);
      }
    }
  }
}
