Let the number of pages be p.
Number of pages read on first day = 3p/8
Remaining pages = p - 3p/8 = (8p - 3p)/8 = 5p/8
Number of pages read on second day = 4/5 x 5p/8 = p/2
Now , remaining pages = p - [ 3p/8 + p/2]
= p - [(3p + 4p)/8] = [p- 7p/ 8]
= [(8p - 7p)/ 8] = p/8
According to the question
p/8 = 40
⇒ p = 40 x 8
∴ p = 320