import Control.Monad

main :: IO ()
main = do
  n <- readLn :: IO Int
  s <- replicateM n (readLn :: IO Int)
  print $ solve s

solve :: [Int] -> Int
solve ls = if sls `mod` 10 == 0 then subsolve ls else sls where
  sls = sum ls

subsolve :: [Int] -> Int
subsolve ls = if null ls' then 0 else sum ls - minimum ls' where
  ls' = filter (\n -> n `mod` 10 /= 0) ls
