compute total before