It might be much simpler. If the OP just has the actual paid/reinvested dividend records for even the past 10 years, that would probably cover most of it. He wouldn't need to know the number of shares, it would all be a cost against the entire holding, regardless of shares, right? He'd need to report those divs for taxes each year, so if he kept copies of his 1099-DIV, it should all be there. I could go back 45 years, I keep all my tax records.
edit/add: Based on the link I gave earlier:
The divs drop from ~ $0.57/Q in 2024, to ~ $0.24 in 2000, $0.11 in 1990 to $0.05 in 1985, so clearly diminishing returns as you go back.