A 2D DP Problem - Collecting apples

Please someone help me with the approach to this 2D DP Problem,

link - https://www.hackerearth.com/practice/algorithms/dynamic-programming/2-dimensional/practice-problems/algorithm/collecting-apples-69/

Thanks!!