Speed up by using matrix coordinates when finding main block
Do not use PRINT_FORMAT for rightcol, it doesn't work with big numbers