Clever python solution based on iterables
Code
# Code
```python3 []
class Solution:
    def maximumAmount(self, coins: List[List[int]]) -> int:
        dp_0 = chain([(0,) * 3], repeat((-inf,) * 3))
        dp_n = reduce(next_dp, coins, dp_0)
        last = deque(dp_n, maxlen=1)[0]
        return max(*last)

def next_dp(dp, row):
    h0 = h1 = h2 = -inf
    for (v0, v1, v2), coins in zip(dp, row):
        h2 = max(v2 + coins, h2 + coins, v1, h1)
        h1 = max(v1 + coins, h1 + coins, v0, h0)
        h0 = max(v0 + coins, h0 + coins)
        yield h0, h1, h2
```
['Python3']