def recursive_transform(lst, index=0):
if index >= len(lst):
return
if lst[index] % 2 == 0:
lst[index] //= 2
else:
lst[index] = lst[index] * 3 + 1
recursive_transform(lst, index + 1)
if index < len(lst) - 1:
lst[index] += lst[index + 1]
numbers = [5, 8, 3, 7, 10]
recursive_transform(numbers)
for i in range(len(numbers) - 1, -1, -1):
numbers[i] = numbers[i] - (numbers[i - 1] if i > 0 else 0)
print(numbers)
ZGVmIHJlY3Vyc2l2ZV90cmFuc2Zvcm0obHN0LCBpbmRleD0wKToKICAgIGlmIGluZGV4ID49IGxlbihsc3QpOgogICAgICAgIHJldHVybgogICAgaWYgbHN0W2luZGV4XSAlIDIgPT0gMDoKICAgICAgICBsc3RbaW5kZXhdIC8vPSAyCiAgICBlbHNlOgogICAgICAgIGxzdFtpbmRleF0gPSBsc3RbaW5kZXhdICogMyArIDEKICAgIHJlY3Vyc2l2ZV90cmFuc2Zvcm0obHN0LCBpbmRleCArIDEpCiAgICBpZiBpbmRleCA8IGxlbihsc3QpIC0gMToKICAgICAgICBsc3RbaW5kZXhdICs9IGxzdFtpbmRleCArIDFdCgpudW1iZXJzID0gWzUsIDgsIDMsIDcsIDEwXQpyZWN1cnNpdmVfdHJhbnNmb3JtKG51bWJlcnMpCgpmb3IgaSBpbiByYW5nZShsZW4obnVtYmVycykgLSAxLCAtMSwgLTEpOgogICAgbnVtYmVyc1tpXSA9IG51bWJlcnNbaV0gLSAobnVtYmVyc1tpIC0gMV0gaWYgaSA+IDAgZWxzZSAwKQoKcHJpbnQobnVtYmVycykK