main = getContents >>= print . solve 0 0 1000000000 . map read . tail . words

solve cnt s m [] =
    if cnt `mod` 2 == 0 then s else s - 2 * m
solve cnt s m (a:as) =
    if a <= 0
    then solve (cnt + 1) (s - a) (min m (-a)) as
    else solve cnt (s + a) (min m a) as