logo AlgoBeat OnlineJudge
登录 注册

#103212. [BZOJ 3212] Pku3468 A Simple Problem with Integers

内存限制:128 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

You have integers, . 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 and .

The second line contains numbers, the initial values of .

Each of the next lines represents an operation.

  • C a b c means adding to each of .

  • Q a b means querying the sum of .

输出格式

You need to answer all 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

样例输出 #1

4
55
9
15

数据范围与提示

  • , , .

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