import Control.Monad

main = do
  n <- readLn
  ss <- replicateM n getLine
  print . f $ ss

f xs
  | mod (sum xs) 10 /= 0 = sum xs
  | all (`mod` 10 == 0) xs = 0
  | otherwise = (sum xs) - maximum [x | x <- xs, mod x 10 /= 0] 