#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
using namespace std;
template<class T>inline void read(T &num)
{
char ch; int flag=1;
while(!isdigit(ch=getchar()))if(ch=='-')flag=-flag;
for(num=ch-'0';isdigit(ch=getchar());num=num*10+ch-'0');
num*=flag;
}
#define lowbit(x) (x&(-x))
#define LL long long
const int MAXN = 100005;
int n, q;
LL seq[MAXN], T[2][MAXN], ret[2];
inline void update(int x, int val) { for(int i = x; i <= n; i += lowbit(i)) T[0][i] += val, T[1][i] += 1ll * val * x; }
inline void mdf(int l, int r, int val) { update(l, val), update(r+1, -val); }
inline LL sum(int x)
{
ret[0] = ret[1] = 0;
for(int i = x; i; i -= lowbit(i))
ret[0] += T[0][i], ret[1] += T[1][i];
return ret[0] * (x+1) - ret[1];
}
int main()
{
read(n), read(q);
for(int i = 1; i <= n; i++) read(seq[i]), seq[i] += seq[i-1];
char s[2]; int x, y, z;
while(q--)
{
scanf("%s", s), read(x), read(y);
if(s[0] == 'Q') printf("%lld
", sum(y) - sum(x-1) + seq[y] - seq[x-1]);
else read(z), mdf(x, y, z);
}
}