let xs = Array.init 5 @@ fun _ -> read_int ()
let ws = Array.map (fun x -> (10 - x mod 10) mod 10) xs
let _ = Array.(fold_left (+) 0 xs + fold_left (+) 0 ws - fold_left max ws.(0) ws) |> Printf.printf "%d\n"