5. fix bug of comparison

if (r(i) > ((q+1)/q))