#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
inline void read(long long &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
inline void write(int x) {
  static const int maxlen = 100;
  static char s[maxlen];
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (!x) {
    putchar('0');
    return;
  }
  int len = 0;
  for (; x; x /= 10) s[len++] = x % 10 + '0';
  for (int i = len - 1; i >= 0; --i) putchar(s[i]);
}
const int MAXN = 100010;
const int MAXP = 60;
int n, m;
int a[MAXN];
char s[100];
int nex[MAXN];
int get_nex(int x) {
  int now = 0;
  for (int i = x; i <= n; i++) {
    now += (now % a[i]) ? 1 : 2;
    if (now == 60) return i + 1;
  }
  return n + 1;
}
int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i <= n; i++) nex[i] = get_nex(i);
  read(m);
  for (int i = 1; i <= m; i++) {
    scanf("%s", s);
    int x, y;
    read(x);
    read(y);
    if (s[0] == 'A') {
      int ans = 0;
      while (nex[x] < y) x = nex[x], ans += 60;
      while (x < y) {
        ans += (ans % a[x]) ? 1 : 2;
        x++;
      }
      printf("%d\n", ans);
    } else {
      a[x] = y;
      for (int i = x; nex[i] >= x; i--) nex[i] = get_nex(i);
    }
  }
  return 0;
}
