#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double PI = acos(-1.0);
int t[100005 << 2][60], x;
void push_up(int k) {
  for (int i = 0; i < 60; i++)
    t[k][i] = t[k << 1][i] + t[k << 1 | 1][(t[k << 1][i] + i) % 60];
}
void build(int k, int l, int r) {
  if (l == r) {
    scanf("%d", &x);
    for (int i = 0; i < 60; i++) t[k][i] = (i % x == 0) ? 2 : 1;
    return;
  }
  int mid = (l + r) >> 1;
  build(k << 1, l, mid);
  build(k << 1 | 1, mid + 1, r);
  push_up(k);
}
void update(int k, int l, int r, int a, int b) {
  if (l == r) {
    for (int i = 0; i < 60; i++) t[k][i] = (i % b == 0) ? 2 : 1;
    return;
  }
  int mid = (l + r) >> 1;
  if (a <= mid)
    update(k << 1, l, mid, a, b);
  else
    update(k << 1 | 1, mid + 1, r, a, b);
  push_up(k);
}
int query(int k, int l, int r, int a, int b, int init_time) {
  if (a <= l && r <= b) return t[k][init_time];
  int mid = (l + r) >> 1;
  int tmp = 0;
  if (a <= mid) tmp += query(k << 1, l, mid, a, b, init_time);
  if (b > mid)
    tmp += query(k << 1 | 1, mid + 1, r, a, b, (init_time + tmp) % 60);
  return tmp;
}
int main() {
  int n, q, a, b;
  char op[5];
  scanf("%d", &n);
  build(1, 1, n);
  scanf("%d", &q);
  while (q--) {
    scanf("%s", op);
    scanf("%d%d", &a, &b);
    if (op[0] == 'C')
      update(1, 1, n, a, b);
    else
      printf("%d\n", query(1, 1, n, a, b - 1, 0));
  }
}
