import java.util.Scanner;

public class SegmentTree {
    private static class Node {
        public int left, right;
        public long add, sum;
        
        public Node(int left, int right, long sum) {
            this.left = left;
            this.right = right;
            this.sum = sum;
        }
    }

    private Node[] tree;
    private int size;

    public SegmentTree(int n,int[] arr) {
        size = (n<<2);
        tree = new Node[size];
        build(0, 0, n-1, arr);
    }
    private void build(int pos, int p, int r, int[] arr) {
        if (p == r) {
            tree[pos] = new Node(p, r, arr[p]);
        } else {
            build(2*pos+1, p, (p+r)/2, arr);
            build(2*pos+2, (p+r)/2+1, r, arr);
            tree[pos] = new Node(p, r, tree[2*pos+1].sum + tree[2*pos+2].sum);
        }
    }
    
    public void update(int p, int r, long delt) {
        p = (tree[0].left < p)? 
        		p : tree[0].left;
        r = (tree[0].right > r)? 
        		r : tree[0].right;
        if (p <= r) {
            updateHelp(0, p, r, delt);
        }
    }
    private void updateHelp(int pos, int p, int r, long delt) {
        if (tree[pos].left>=p && tree[pos].right<=r) {
            tree[pos].add += delt;
            tree[pos].sum += 
                (tree[pos].right-tree[pos].left+1)*delt;
        } else {
            if (tree[pos].add!=0) {
                pushDown(pos);
            }
            int mid = (tree[pos].left+tree[pos].right)/2;
            if (p <= mid) {
                updateHelp(2*pos+1, p, r, delt);
            }
            if (mid+1 <= r) {
                updateHelp(2*pos+2, p, r, delt);
            }
            tree[pos].sum = tree[2*pos+1].sum + tree[2*pos+2].sum;
        }
    }
    private void pushDown(int pos) {
        int left = 2*pos+1, right = 2*pos+2;
        tree[left].add += tree[pos].add;
        tree[right].add += tree[pos].add;
        tree[left].sum += 
            (tree[left].right-tree[left].left+1)*tree[pos].add;
        tree[right].sum += 
            (tree[right].right-tree[right].left+1)*tree[pos].add;
        tree[pos].add = 0;
    }
    
    public long query(int p,int r) {
        if (tree[0].left<=p && tree[0].right>=r) {
            return queryHelp(0,p,r);
        } else {
            return 0;
        }
    }
    private long queryHelp(int pos,int p,int r) {
        if (tree[pos].left>=p && tree[pos].right<=r) {
            return tree[pos].sum;
        } else {
	        if (tree[pos].add!=0) {
	            pushDown(pos);
	        }
	        long val = 0;
	        int mid = (tree[pos].left+tree[pos].right)/2;
	        if (p <= mid) {
	            val += queryHelp(2*pos+1, p, r);
	        }
	        if (mid+1 <= r) {
	            val += queryHelp(2*pos+2, p, r);
	        }
	        return val;
        }
    }
    
    
    public static void main(String[] args) {
        Main.main(args);
    }
}

class Main {
	
	/** POJ 3468: http://poj.org/problem?id=3468 */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        int q = in.nextInt();
        for (int i=0;i<n;i++) {
            arr[i] = in.nextInt();
        }
        SegmentTree tr = new SegmentTree(n,arr);
        for (int i=0;i<q;i++) {
            String op = in.next();
            if (op.equals("C")) {
                int p = in.nextInt()-1;
                int r = in.nextInt()-1;
                tr.update(p,r,in.nextInt());
            } else if (op.equals("Q")) {
                int p = in.nextInt()-1;
                int r = in.nextInt()-1;
                System.out.println(tr.query(p,r));
            }
        }
        in.close();
    }
}

