A finite algorithm for the linear exchange model