import Data.List

main = print . solve . map read . drop 1 . words =<< getContents

solve :: [Int] -> Int
solve xs =
    let s = sort xs
        t = sum s
    in  if mod t 10 /= 0 then t
        else (-) t . head $ (filter (\x -> mod x 10 /= 0) s) ++ [t]
