let a = read_int()
let b = read_int()
let c = read_int()
let d = read_int()
let e = read_int()
let l = [a; b; c; d; e]

let rec f lst = match lst with
    [] -> []
  | first :: rest ->
     let h x = ((x / 10) + 1) * 10 in
     let rec hojo x lst = match lst with
         [] -> [x]
       | first :: rest -> if x mod 10 = 0 then x :: hojo first rest
                          else if (first mod 10) = 0 then first :: hojo x rest
                          else if (x mod 10) < (first mod 10)
                          then (h first) :: hojo x rest
                          else (h x) :: hojo first rest in
     hojo first (f rest)

let () = print_int (List.fold_right (+) (f l) 0)