Formats the totals