#GD0000014. Đợt giảm giá (Sale)
Đợt giảm giá (Sale)
Sale
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are TV sets with prices . A negative price means the seller pays you if you take that TV. You may take at most sets. Find the maximum amount of money you can earn.
Input
The first line contains . The second line contains integers .
Output
Print the maximum amount of money that can be earned.
Subtasks
General constraints:
-
.
-
.
-
Subtask 1 (20 points):
-
Subtask 2 (30 points):
-
Subtask 3 (50 points): No additional constraints.
Examples
Input
5 3
-6 0 35 -2 4
Output
8
Explanation
The TVs priced and earn . A third TV is unnecessary because the remaining prices give no additional profit.