Congratulations! You’ve been hired in “Buggy Software Ltd.” And you’ve been already given your first assignment. Initially, you’ll be given a length array of numbers. Then you’ll be given queries of two types:
1 l r
: meaning that calculate the sum of elements whose indices satisfy 2 l r g
: meaning that change all to where You have to print the results of the queries of the first type.
The first line will contain two integers and , the size of and number of queries respectively. The next line will contain space separated integers, the contents of array . Next lines will each contain the queries: 1 l r
or 2 l r g
.
For each query of type 1, output the answer in a single line.
Input | Output |
---|---|
5 4 2 4 6 8 10 1 2 5 2 1 3 2 2 3 5 3 1 1 5 | 28 22 |