How do you calculate acb on drip?

I had 3 non-registered stocks that were on dividend re-investment plans for 6 years. Last year I sold them all to transfer the money to TFSA.  What value do I put in box 20 on the T5008?