The modulo returns the remainder of a division. For example, 0x3C7 mod 0x4000 = 0x3C7, because 0x3C7 / 0x4000 = 0 with the remainder of 0x3C7. 0x43C7 mod 0x4000 = 0x3C7, because 0x43C7 / 0x4000 = 1 with the remainder of 0x3C7.
You don't have to adapt the modulo to your number, but to the task you want to accomplish. In your case, you probably want to calculate the offset into a ROM bank. The modulo number shouldn't change for that.