#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <bitset>
using namespace std;
const int N = 5e5 + 100;
using ll = long long;
int n, m;
// 当遇到计算和时,使用差分存储信息
ll w[N];
struct Node {
ll l, r;
ll sum, d;
} tr[N * 4];
inline ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}
inline void pushup(Node &u, Node &l, Node &r) {
u.sum = l.sum + r.sum;
u.d = gcd(l.d, r.d);
}
inline void pushup(ll u) {
pushup(tr[u], tr[u << 1], tr[u << 1 | 1]);
}
void build(ll u, ll l, ll r) {
if (l == r) {
ll b = w[r] - w[r - 1];
tr[u] = {l, l, b, b};
} else {
tr[u] = {l, r};
ll mid = l + r >> 1;
build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
pushup(u);
}
}
void modify(ll u, ll x, ll v) {
if (tr[u].l == x && tr[u].r == x) {
ll b = tr[u].sum + v;
tr[u] = {x, x, b, b};
} else {
ll mid = tr[u].l + tr[u].r >> 1;
if (mid >= x) modify(u << 1, x, v);
else modify(u << 1 | 1, x, v);
pushup(u);
}
}
Node query(ll u, ll l, ll r) {
if (tr[u].l >= l && tr[u].r <= r) return tr[u];
else {
ll mid = tr[u].l + tr[u].r >> 1;
if (r <= mid) return query(u << 1, l, r);
else if (l > mid) return query(u << 1 | 1, l, r);
else {
auto left = query(u << 1, l, r);
auto right = query(u << 1 | 1, l, r);
Node res;
pushup(res, left, right);
return res;
}
}
}
int main() {
ios::sync_with_stdio(false);
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> w[i];
build(1, 1, n);
string op;
int l, r;
ll d;
while (m--) {
cin >> op;
cin >> l >> r;
if (op == "C") {
cin >> d;
modify(1, l, d);
if (r + 1 <= n)modify(1, r + 1, -d);
} else {
auto left = query(1, 1, l);
Node right = Node{0, 0, 0, 0};
if (l + 1 <= r) right = query(1, l + 1, r);
cout << abs(gcd(left.sum, right.d)) << endl;
}
}
return 0;
}