// _ooOoo_
// o8888888o
// 88" . "88
// (| -_- |)
// O\ = /O
// ____/`---'\____
// . ' \| |// `.
// / \||| : |||// \
// / _||||| -:- |||||- \
// | | \\ - /// | |
// | \_| ''\---/'' | |
// \ .-\__ `-` ___/-. /
// ___`. .' /--.--\ `. . __
// ."" '< `.___\_<|>_/___.' >'"".
// | | : `- \`.;`\ _ /`;.`/ - ` : | |
// \ \ `-. \_ __\ /__ _/ .-` / /
// ======`-.____`-.___\_____/___.-`____.-'======
// `=---='
//
// .............................................
// 佛祖保佑 一发AC 永无BUG
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
typedef pair<int, int> PII;
LL bit[maxn], a[maxn] ,biti[maxn];
LL lowbit(LL x) { return x & -x; }
LL n, m;
LL ask(LL bit[] , LL x) {
LL ans = 0;
for (; x > 0; x -= lowbit(x)) {
ans += bit[x];
}
return ans;
}
void updata(LL bit[],LL x, LL val) {
for (; x <= n; x += lowbit(x)) {
bit[x] += val;
}
}
int main(int argc, char const *argv[]) {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
LL x, y, e;
for (int i = 1; i <= n; i++) updata(bit, i, a[i] - a[i - 1]), updata(biti, i, i * (a[i] - a[i-1]));
while (m--) {
char op[4];
cin >> op;
if (op[0] == 'Q') {
cin >> x >> y;
LL L = (x) * ask(bit,x-1) - ask(biti, x-1);
LL R = (y+1) * ask(bit,y) - ask(biti, y);
cout << R - L << endl;
} else {
cin >> x >> y >> e;
updata(bit, x, e);
updata(bit, y + 1, -e);
updata(biti, x, x * e);
updata(biti, y + 1, - (y + 1) * e);
}
}
return 0;
}