input The input consists of three lines. In the first line, the number of variety of…
- User
input The input consists of three lines. In the first line, the number of variety of products is given, in the second line, the inventory number of each product is given with a space, and in the third input line, the number of previous orders is added. 1 ≤ n ≤ 100
000 1≤n≤100 000 1 ≤ l i s t [ n ] ≤ 1 0 9 1≤list[n]≤10 9
1 ≤ k ≤ 1 0 9 1≤k≤10 9
output The output is an integer, which is the remainder of the maximum extra points in Digiclub 1 0 9 + 7 10 9 It is +7.
Example Sample entry 1 1 5 2 Plain text Sample output 1 9 Plain text In this example, the add-on has only one choice. The first time he picks up the item, he will receive 5 points and the inventory will be reduced to 4. The second time he chooses the product, he receives 4 points and cannot choose any more. Therefore, he receives a total of 9 points.
Sample input 2 3 5 1 2 5 Plain text Sample output 2 16 Plain text In this example, he chooses the first item in the list, which has 5 items, every 3 times. Therefore, it receives 5, 4 and 3 points respectively. Now the stock of the warehouse is in the form of [2, 1, 2]. Therefore, he takes the next two choices from the first and third item and receives a total of 16 points. c++
- Assistant