let round_up n = 
  let r = n mod 10 in
    if r = 0 then n 
    else n + 10 - r
;;

let add n = 
  let r = n mod 10 in
    if r = 0 then 0
    else 10 - r
;;

let r_max a b c d e =
  max (max (max (max (add a) (add b)) (add c)) (add d)) (add e)
;;


let () = Scanf.scanf "%d\n%d\n%d\n%d\n%d" (fun a b c d e -> (
  (round_up a) + (round_up b) + (round_up c) + (round_up d) + (round_up e) - r_max a b c d e |> print_int
));;