How to treat inherited assets from a relative that died years ago.

My younger brother and I were determined to be the sole heirs of a stock account that had gone dormant. My distant relative died in 2005 but being a dividend reinvestment account the dividends continued to purchase stock after the relative's death in 2005. From what I understand the basis will be the date of death. But what about the stock purchased by dividends deposited to the reinvestment account after 2005 until 2022? Should the basis of those shares be based on the purchase price of the actual date?

 

Secondly to get this settled we had to pay a commission to a company to facilitate the transaction and some legal fees to establish us as the sole heirs. Where and how are these expenses accounted for?

 

Thanks for your help to a very confusing situation.