How to calculate retained earnings for SMBs