### Vincent Massey SS - 2014 Senior Contest #1

## Problem A: Firebending

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 `n` integers, one per line. For each of the integers, `k`_{i}, you can either keep it as `k`_{i}, or change it to −`k`_{i}. Find the maximum possible final sum of all the integers.

### Input Format

The first line contains the integer `n` (1 ≤ `n` ≤ 100,000).

The next `n` lines will contain the integers `k`_{i}.

### Output Format

The largest possible final sum of the `n` integers.

### Sample Input

3 1 -2 3

### Sample Output

6

### Explanation

Keep 1.

Change -2 to 2.

Keep 3.

Thus, the answer is 1 + 2 + 3 = 6.

All Submissions

Best Solutions

**Point Value:** 3

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Nov 04, 2014

**Author:** thorthugnasty

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

mathdude2017on Jan 30, 2019 - 10:26:34 pm UTC IntStreammagicalsoupon Jan 31, 2019 - 12:10:03 am UTC Re: IntStreamjargonon Feb 02, 2019 - 7:41:57 pm UTC Re: IntStream