you give 0indexed m x n integer matrix grid integer k you currently position 0 0 want reach position m 1 n 1 move rightreturn number path sum element path divisible k since answer large return modulo 109 7 Example 1input grid 524305072 k 3Output 2explanation there path sum element path divisible kThe path highlight red sum 5 2 4 5 2 18 divisible 3the second path highlight blue sum 5 3 0 5 2 15 divisible 3example 2input grid 00 k 5output 1explanation the path highlight red sum 0 0 0 divisible 5example 3input grid 734923622370 k 1output 10explanation every integer divisible 1 sum element possible path divisible k Constraintsm gridlengthn gridilength1 m n 5 1041 m n 5 1040 gridij 1001 k 50