let () = Scanf.scanf "%d %d %d %d %d" @@ fun a b c d e ->
  Printf.printf "%d\n" @@
  List.fold_left (fun acc a -> acc + a + 9 - (a + 9) mod 10) 0 [a; b; c; d; e]
  - List.fold_left (fun acc a -> max acc (9 - (a + 9) mod 10)) 0 [a; b; c; d; e]
