calculate the final score