maxProduct and minProduct of the same size as the input grid, to store the maximum and minimum product paths respectively.maxProduct and minProduct to the value of the first cell in the grid.maxProduct and minProduct matrices with the maximum and minimum of these values, respectively.maxProduct.-1. Otherwise, return the value modulo 10^9 + 7.