import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List as List


solve2 :: [Int] -> Int -> Int
solve2 [] total = 0
solve2 (x:xs) total
    | total `mod` 10 > 0 = total
    | x `mod` 10 > 0 = total - x
    | otherwise = solve2 xs total

solve :: [Int] -> Int
solve arr = solve2 sorted total
    where
        total = sum arr
        sorted = List.sort arr

main :: IO()
main = do
    n <- (fst . fromJust . BS.readInt) <$> BS.getLine
    arr <- replicateM n ((fst . fromJust . BS.readInt) <$> BS.getLine)
    print $ solve arr
