Python

```python3 []
class Solution:
    def maximumAmount(self, coins: List[List[int]]) -> int: 
        m, n = len(coins), len(coins[0])
        @cache 
        def dfs(i,j,k) :  
            if i == m - 1 and j == n - 1 : 
                return max(0, coins[i][j]) if k else coins[i][j]
            if i >= m or j >= n : 
                return -float("inf")
            else :   
                skip = -float(inf)
                if k and coins[i][j] < 0 : 
                    skip = max(dfs(i + 1,j, k - 1), dfs(i, j + 1, k - 1)) 
    
                take = coins[i][j] + max(dfs(i + 1, j, k), dfs(i, j + 1, k))
                return max(skip,take)
        return dfs(0,0,2)



        
```
['Python3']