Percentage By Mass Calculation

hey

A 4.675g sample of limestone (impure CaCO3) was treated with 375ml of 0.261 molL^-1 hydrochloric acid. After the reaction was over, the mixture was filtered and a 25 ml sample of the filtrate required 17.62ml of 0.0517 molL^-1 barium hydroxide solution for complete neutralisation. 

Calculate the percentage by mass of CaCO3 in the limestone sample.

Thinking:

I know that the method to solve these types of questions is to work backwards, but since there are technically 2 chemical reactions in the question, I'm confused as to how to relate one to the other in order to solve it.