Computing Capital Gains

For years I have been rolling my dividends into buying additional shares of my mutual fund.  Now that I have sold some shares of my fund do I add the the dividends I paid for the purchases into my original purchase to determine the basis for my capital gain?