bigint: O(mn) time now satisfied