In reply to DImitri.

For positive arguments, mod(a,q) is always in the range {0, 1, ..., q-1}. For a=2 and q=3, mod(2,3)=2.