Retained Earnings:
Retained earnings at the begining of the year+ Net profit for the year+ Any other realised profits - dividends paid to common stockholders= Retained Earnings at the end of the year.
Any other realised profits = This is a very broad area and can include realised profits for excess depreciation on an asset revalued upwards,Sale of P&M revalued upwards, Sale of AFS assets, etc.
Cheers
Sumo