import Data.List
main=do
 l<-map read.lines<$>getContents :: IO[Int]
 let s=(sortBy (\a b->compare (mod a 10) (mod b 10)).filter (\x->(x`mod`10)>0)) l
 print$if null s then sum l else (head s)+(sum [k|x<-(filter (/=(head s)) l),let k=if mod x 10 ==0 then x else x+(10-(mod x 10))])