Knizhnik-zamolodchikov Equations and Finite-gap Integration