I have input data like this:
4 #length of way BD 1C BD 55 #way 5 #matrix size (5x5 now) 1C BD 1C 55 55 #matrix 55 55 55 1C 1C E9 1C 5