Performs modular arithmetic operations