implementation of serial version of matrixmultiplication