Please explain in detail

why are we returning ANS =1 when we are having negative value. By doing this we are adding 1 to the ans but Addition and Substraction should be done on what we have in arr[i][j] .If the path we take returns negative value we should change the path.