[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let f x = if x % 10 = 0 then x else (x + 10) / 10 * 10

[<EntryPoint>]
let main argv =
    let xs = List.map (fun _ -> read int) [1..5]
    let (ps, qs) = List.partition (fun x -> x % 10 = 0) xs
    if List.isEmpty qs then
        ps
    else
        let r :: rs = List.sortBy (fun x -> x % 10) qs
        r :: ps @ List.map f rs
    |> List.sum
    |> printfn "%i"
    0