Alice purchased an array of wooden boxes that she indexed from to . On each box , she writes an integer that we'll refer to as .
Alice wants you to perform operations on the array of boxes. Each operation is in one of the following forms:
(Note: For each type of operations, )
1 l r c: Add to each . Note that can be negative.
2 l r d: Replace each with .
3 l r: Print the minimum value of any .
4 l r: Print the sum of all .
Recall that is the maximum integer such that (e.g., and ).
Given , the value of each , and operations, can you perform all the operations efficiently?
The first line contains two space-separated integers denoting the respective values of (the number of boxes) and (the number of operations).
The second line contains space-separated integers describing the respective values of (i.e., the integers written on each box).
Each of the subsequent lines describes an operation in one of the four formats defined above.
For each operation of type or type , print the answer on a new line.