O(n*m) implementation of T1100