import Control.Monad
import Data.List

main = do
  n <- readLn :: IO Int
  xs <- replicateM n readLn :: IO [Int]
  let s = solve xs
  print $ if s `mod` 10 == 0 then 0 else s

solve :: [Int] -> Int
solve [] = 0
solve xs =
  let
    ts = filter (flip elem [0,10..100]) xs
    nts = filter (flip notElem [0,10..100]) xs
  in
    sum ts + trim nts
  where
    trim :: [Int] -> Int
    trim [] = 0
    trim xs
      | sum xs `mod` 10 == 0 = trim (delete (minimum xs) xs) 
      | otherwise = sum xs