#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, m;
int a[N];
int dp[N << 2][60];
inline void pushup(int rt) {
  int t;
  for (int i = int(0); i <= int(59); ++i) {
    t = (i + dp[rt << 1][i]) % 60;
    dp[rt][i] = dp[rt << 1][i] + dp[rt << 1 | 1][t];
  }
}
void build(int rt, int l, int r) {
  if (l == r) {
    for (int i = int(0); i <= int(59); ++i) {
      if (i % a[l] == 0)
        dp[rt][i] = 2;
      else
        dp[rt][i] = 1;
    }
    return;
  }
  int m = (l + r) >> 1;
  build(rt << 1, l, m);
  build(rt << 1 | 1, m + 1, r);
  pushup(rt);
}
void change(int p, int d, int rt, int l, int r) {
  if (l == r) {
    for (int i = int(0); i <= int(59); ++i) {
      if (i % d == 0)
        dp[rt][i] = 2;
      else
        dp[rt][i] = 1;
    }
    return;
  }
  int m = (l + r) >> 1;
  if (p <= m)
    change(p, d, rt << 1, l, m);
  else
    change(p, d, rt << 1 | 1, m + 1, r);
  pushup(rt);
}
int query(int L, int R, int t, int rt, int l, int r) {
  if (L <= l && r <= R) return dp[rt][t];
  int m = (l + r) >> 1;
  int t1 = 0, t2 = 0;
  if (L <= m) t1 = query(L, R, t, rt << 1, l, m);
  if (R > m) t2 = query(L, R, (t + t1) % 60, rt << 1 | 1, m + 1, r);
  return t1 + t2;
}
int main() {
  scanf("%d", &n);
  for (int i = int(1); i <= int(n); ++i) scanf("%d", a + i);
  build(1, 1, n);
  scanf("%d", &m);
  char s[5];
  int x, y;
  for (int i = int(1); i <= int(m); ++i) {
    scanf("%s%d%d", s, &x, &y);
    if (s[0] == 'C')
      change(x, y, 1, 1, n);
    else
      printf("%d\n", query(x, y - 1, 0, 1, 1, n));
  }
}
