main = interact $ show . sol . fmap read . tail . lines

sol ss
  | null s0       = 0
  | s `mod` 10>0  = s 
  | otherwise     = s - minimum s0
  where
  s = sum ss
  s0 = filter ((/=0) . (`mod` 10)) ss