Perform calculation over modulus.