mod returns the remainder of m divided by n. Returns m if n is 0.