How do I Show Retained Earnings at Year End, Net of Current Year Earnings

How do I Show Retained Earnings at Year End, Net of Current Year Earnings

I'm a little confused by how this is currently reflected in the end of period balance sheet - I currently see year earnings as a line item in the balance sheet for year end.

Retained earnings  (RE) =  Period start RE + Net Income / Loss (post-tax) - Dividends (cash / stock)

20,000 = 10,000 + 50,000 - 40,000

Instead, I have a balance of -30,000 for retained earnings, as all dividends are all interim payments, with money leaving the company mid-year.

In itself, this is a bit of a no-no (in the UK at least, where it is unlawful under the 2006 Companies Act) - because the retained earnings are showing a negative and dividends being paid (even though during the year, there are funds available).

How do I show a retained earnings balance at end of year, net of of current earnings?