another question :
You used absolute value on 'R' in Denominator. It is true when 'R' is positive but suppose 'R' is negative like these cases :
case 1 : P=1000, R=2000
case 2 : P=-1000 R=-500
In case 2 we have 500 in denominator so we have different value from real value of R=-500 here. you see we have difference of 500-(-500)=1000 here with real value of R. Isn't this a problem for the created criteria?