import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import Data.List

readIntLines :: IO [Int]
readIntLines = map (fst . fromJust . BC.readInt) . BC.lines <$> BC.getContents

solve :: Int -> [Int] -> Int
solve m [] = if m `mod` 10 == 0 then 0 else m
solve m (s:ss)
  | m `mod` 10 /= 0 = m
  | otherwise = solve (m - s) ss

main :: IO ()
main = do
  getLine
  ss <- sort <$> readIntLines
  let m = sum ss
  print $ solve m ss