import Control.Monad
 
main = do
  n <- readLn
  ss <- replicateM n getLine
  putStr . show . f $ ss
 
f xs
  | mod (sum xs) 10 /= 0 = sum xs
  | all (\x -> mod x 10 == 0) xs = 0
  | otherwise = (sum xs) - maximum [x | x <- xs, mod x 10 /= 0] 