Example 1

Example 2

1 <= m, n <= 1051 <= m * n <= 105The number of nodes in the list is in the range [1, m * n].0 <= Node.val <= 1000Example 1

Example 2

1 <= m, n <= 1051 <= m * n <= 105The number of nodes in the list is in the range [1, m * n].0 <= Node.val <= 1000