Firebending
View as PDFVincent Massey SS - 2014 Senior Contest #1
Firebending is the element of power. Firebenders use their energy to create bursts of fire in order to overwhelm their opponent. As a result, they want to maximize the value of each fire blast that they shoot. In order to do so, they must revisit the art of mathematics.
You will be given  integers, one per line. For each of the integers,
, you can either keep it as 
, or change it to 
.
Find the maximum possible final sum of all the integers.
Input Specification
The first line will contain the integer  
.
The next  lines will contain the integers 
.
Output Specification
The largest possible final sum of the  integers.
Sample Input
3
1
-2
3
Sample Output
6
Explanation
Keep .
Change  to 
.
Keep .
Thus, the answer is .
Comments
Being negative can never contribute to maximizing your happiness.