Ending Balance Formula