## An Array Problem

View as PDF

Points: 7
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Given an array of length , support of the following operations:

• 1 l r v k Subtract from all elements only if .
• 2 l r k Sum up all elements only if .

, , and .

#### Input Specification

The first line will contain two integers, .

The next line will contain integers, .

The next lines will each contain a valid operation as defined above.

#### Output Specification

For each type operation, print out the desired answer on its own line.

#### Sample Input

4 3
2 3 1 4
1 1 3 2 1
2 1 2 0
2 3 4 1

#### Sample Output

1
4