Take the number of matrices to multiply from the command line
Added preprocessor flag to allow disabling memoization