#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int n, m, a[N];
typedef long long LL;
LL tr1[N], tr2[N];
int lowbit(int x) {
return x & -x;
}
void add(LL tr[], int x, LL c) {
for (int i = x; i <= n; i += lowbit(i)) tr[i] += c;
}
LL sum(LL tr[], int x) {
LL res = 0;
for (int i = x; i; i -= lowbit(i)) res += tr[i];
return res;
}
LL psum(int x) {
return sum(tr1, x) * (x + 1) - sum(tr2, x);
}
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
int b = a[i] - a[i - 1];
add(tr1, i, b);
add(tr2, i, (LL) b * i);
}
while (m--) {
char op;
LL l, r, d;
cin >> op >> l >> r;
if (op == 'Q') {
cout << psum(r) - psum(l - 1) << endl;
} else {
cin >> d;
add(tr1, l, d), add(tr2, l, l * d);
add(tr1, r + 1, -d), add(tr2, r + 1, -(r + 1) * d);
}
}
}