fixing the scoring function to match given formula