import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Data.List
import Control.Monad

solve xs = loop t o
    where
        t = filter (\v -> v `rem` 10 == 0) xs
        o = filter (\v -> v `rem` 10 /= 0) xs
        loop t o
            | null o = 0
            | (sum o `rem` 10) == 0 = loop t (delete (minimum o) o)
            | otherwise = sum o + sum t

main = do
    n <- readLn :: IO Int
    xs <- replicateM n (fst . fromJust . B.readInt <$> B.getLine)
    print $ solve xs