added matrix multiplication and power with MOD