let id x = x
let n = Scanf.scanf "%d\n" id
 
let array = Array.init n (fun _ -> Scanf.scanf "%d\n" id)
let l = Array.length array
  
let rec pl i =
  if i = l then 0 else
    array.(i) + pl (i+1)
      
let rec func ans i =
  if ((ans mod 10) <> 0) then ans else
    if i = l then 0 else
    func (ans - array.(i)) (i+1)
      
let ans = func (pl 0) 0

let () =
  Array.sort compare array;
  Printf.printf "%d\n" ans