implicit none
integer,dimension(5)::a
integer i
integer:: min1=9
integer:: sum=40

do i=1,5
read(5,*) a(i)
sum=sum+(a(i)/10)*10

if(mod(a(i),10).le.min1.and.mod(a(i),10).gt.0) then
min1=mod(a(i),10)
endif

enddo

write(6,*)sum+min1


end