let a_s = Array.init 5 @@ fun _ -> Scanf.scanf " %d" (+) 0
let s, m = Array.fold_left (fun (s, m) a -> let w = (10 - a mod 10) mod 10 in s + a + w, max m w) (0, 0) a_s
let _ = Printf.printf "%d\n" @@ s - m