"""
Created on Mon Dec  9 09:23:00 2024
@author: vila
"""

def mellow_walk(L, signL, i0):
    i = i0
    pL = []
    while -len(L) <= i < len(L) and i not in pL:
        pL.append(i)
        if signL[i] == 1:
            i += L[i]
        elif signL[i] == 0:
            i = L[i]
        else:
            i -= L[i]
    return pL, i

