Calculation of Quality Score