// poj 3468
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int inf=1<<28;
int n,m,k;
int a[100010];
struct node
{
int l,r;
long long sum;
long long add;
}ltree[400010];
void build(int root,int l,int r)
{
ltree[root].l=l;
ltree[root].r=r;
ltree[root].add=0;
if (l==r)
{
ltree[root].sum=a[l];
return ;
}
int mid=(l+r)>>1;
build (root*2,l,mid);
build (root*2+1,mid+1,r);
ltree[root].sum=ltree[root*2].sum+ltree[root*2+1].sum;
}
void insert(int root,int l,int r,long long val)
{
if (ltree[root].l==l && ltree[root].r==r )
{
ltree[root].add+=val;
ltree[root].sum+=(r-l+1)*val;
return ;
}
if (ltree[root].add)
{
ltree[root*2].add+=ltree[root].add;
ltree[root*2].sum+=ltree[root].add*(ltree[root*2].r-ltree[root*2].l+1);
ltree[root*2+1].add+=ltree[root].add;
ltree[root*2+1].sum+=ltree[root].add*(ltree[root*2+1].r-ltree[root*2+1].l+1);
ltree[root].add=0;
}
int mid=(ltree[root].l+ltree[root].r)>>1;
if (r<=mid)
insert(root*2,l,r,val);
else if (l>mid)
insert(root*2+1,l,r,val);
else
{
insert(root*2,l,mid,val);
insert(root*2+1,mid+1,r,val);
}
ltree[root].sum=ltree[root*2].sum+ltree[root*2+1].sum;
}
long long query(int root,int l,int r)
{
if (ltree[root].l==l && ltree[root].r==r )
{
return ltree[root].sum;
}
if (ltree[root].add)
{
ltree[root*2].add+=ltree[root].add;
ltree[root*2].sum+=ltree[root].add*(ltree[root*2].r-ltree[root*2].l+1);
ltree[root*2+1].add+=ltree[root].add;
ltree[root*2+1].sum+=ltree[root].add*(ltree[root*2+1].r-ltree[root*2+1].l+1);
ltree[root].add=0;
}
int mid=(ltree[root].l+ltree[root].r)>>1;
if (r<=mid)
return query(root*2,l,r);
else if (l>mid)
return query(root*2+1,l,r);
else return query(root*2,l,mid) + query(root*2+1,mid+1,r);
}
int main()
{
int v,w;
long long c;
char op[3];
while (scanf("%d%d",&n,&m)!=EOF)
{
for (int i=1;i<=n;i++)
scanf("%d",&a[i]);
build(1,1,n);
while (m--)
{
scanf("%s%d%d",op,&v,&w);
if (op[0]=='C')
{
scanf("%lld",&c);
insert(1,v,w,c);
}
else
printf("%lld/n",query(1,v,w));
}
}
return 0;
}