integer,allocatable,dimension(:)::K,A
integer ans
allocate(K(5),A(5))
do i=1,5
 read*,K(i)
 A(i)=mod(K(i),10)
 if(mod(K(i),10)/=0)K(i)=K(i)+10-A(i)
 if(A(i)==0)A(i)=10
end do
ans=sum(K)-10+minval(a)
print"(i0)",ans
end