#C6398. Maximum Beauty Value Sum
Maximum Beauty Value Sum
Maximum Beauty Value Sum
You are given several test cases. In each test case, you are provided with a collection of flowers, where each flower has a beauty value. Your task is to determine the maximum possible sum of beauty values for any non-empty subsequence of flowers. Since all the beauty values are non-negative, the answer for each test case is simply the sum of all the given beauty values modulo \(10^9+7\).
Note: A subsequence is a sequence that can be derived from the list by deleting some or no elements without changing the order of the remaining elements. In this problem, since every flower has a non-negative beauty value, the optimal approach is to take all the flowers.
The modulo operation is used to prevent overflow. In mathematical terms, if \(S\) is the sum of beauty values, you need to output \(S \bmod (10^9+7)\).
inputFormat
The input begins with a single integer \(T\) representing the number of test cases. For each test case:
- The first line contains an integer \(n\) — the number of flowers.
- The second line contains \(n\) space-separated integers representing the beauty values of the flowers.
You can assume that \(n \geq 0\) and all beauty values are non-negative integers.
outputFormat
For each test case, output a single line containing one integer — the maximum possible sum of beauty values modulo \(10^9+7\>.
## sample2
3
1 2 3
3
4 5 6
6
15
</p>