A Simple Problem with Integers
题号:NC51100
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 128 M,其他语言256 M
64bit IO Format: %lld

题目描述

You have N integers, A_1, A_2, ... , A_N. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum of numbers in a given interval.

输入描述:

The first line contains two numbers N and Q. 
The second line contains N numbers, the initial values of A_1, A_2, ... , A_N.
Each of the next Q lines represents an operation.
"C a b c" means adding c to each of
"Q a b" means querying the sum of

输出描述:

You need to answer all Q commands in order. One answer in a line.
示例1

输入

复制
10 5
1 2 3 4 5 6 7 8 9 10
Q 4 4
Q 1 10
Q 2 4
C 3 6 3
Q 2 4

输出

复制
4
55
9
15

备注:

The sums may exceed the range of 32-bit integers.