sum output correctly