Calculate total.