program main
	implicit none
	integer :: a(1:5),i, temp, ans = 0
	do i = 1, 5
		read(*, *) a(i)
	end do

	temp = 1
	do i = 2, 5
		if(mod(a(temp),10) > mod(a(i),10) .AND. mod(a(i),10) > 0) then
			temp = i
		end if
	end do
	do i = 1, temp-1
		if(mod(a(i),10) /= 0) then
			ans = ans + (a(i) + (10 - mod(a(i),10))) 
		else
			ans = ans + a(i)
		end if
	end do
	
	do i = temp+1, 5
		if(mod(a(i),10) /= 0) then
			ans = ans + (a(i) + (10 - mod(a(i),10))) 
		else
			ans = ans + a(i)
		end if
	end do

	write(*, *) ans + a(temp)

end program main