a[ii]$[x;a[-x;$[y;a[x;-y];1]];+y]

Twetch ยท

a[ii]$[x;a[-x;$[y;a[x;-y];1]];+y]