Finding the value of r or d