Retained Earnings | Doubt

Hi,

I have a small doubt here, how we are deriving retained earnings in this attached example:
Retained Earnings Formula = RE0-NI-D
It seems, we are subtracting NI from 1000 (cash at T0), so are we considering cash at T0 as RE0 because this is not paid out as dividend?