let () = Printf.printf "%d\n" @@
  Scanf.scanf "%d %d %d %d %d" @@ fun a b c d e ->
  let h, s = List.fold_left (fun (x, s) y -> max x ((10 - y mod 10) mod 10), s + (y + 9) / 10 * 10) (0, 0) [a;b;c;d;e] in
  s - h
