INPUT is not a CAS command and you can not use it inside a CAS program.
Personally I do not like to work with the INPUT command when dealing with CAS problems.
It is possible though.
In one source program you can define 2 programs, a CAS program which begins with #cas and ends with #end, and a non-CAS program.
Within the CAS program you can call the non-CAS program which contains the INPUT command, and which must be exported.
You thus get the variable for further use in the CAS program.
Of course the variable can not be a local variable in the non-CAS program in this case.
Because you intend to work with matrices it is maybe simplest to use a global variable like M1, or maybe you can define a local variable m at the beginning of the source program, which can be used by both programs.