Fix the computing of q = mod / p

The computing of mod / p wasn't quite accurate with the 'div' offered by Python 3.