My FIL had a situation like this, a DRIP for IBM shares that went back 3-4 decades, and he hadn't understood that he needed to keep all dividend purchase records for cost basis, he just kept end of year statements which didn't break out quarterly purchases, and even those were spread out among piles of records. This doesn't help you, but in his case we had him just hang on to it until he passed away and the cost basis reset so we could sell it.
The complexity of tracking all of that for small amounts, especially with splits and such, means I don't reinvest dividends from stocks and mutual funds, I let them accumulate in the brokerage cash sweep account and buy something specific with them. In your case, it could be very hard to get all the cost bases, so I'd second the suggestion to either estimate very low or zero purchase prices for the shares you can't get. An extra couple hundred in taxes at long term capital gains rates may not be worth spending days trying to piece it together, especially if you can charge it against a capital loss from selling something else.