"C gets half of the remaining books, and the remaining books are exactly one eighth of the total books." Then c gets the same as the rest, that is, 1/8 of the total. Take the total as a whole 1. So the number of these books is:
(5+7)/(1-1/8-1/8-1/4-1/5) = 40 copies.