main=do
 s<-map read.lines<$>getContents
 let p = filter(\x->if last(show x)=='0' then False else True) s
 let q = foldl1 (\x y ->if x-read(init(show x))*10>=y-read(init(show y))*10 then y else x) p
 let t = map (\x -> if x`mod`10/=0 then read(init(show x))*10+10 else x) (filter (/=p) s)
 print$sum t + q