The default behaviour of components is to keep iterating until all inputs have been dealt with. Because your z input contains 4 values, the component will run 4 times. It isn’t smart enough to understand that under some conditions the z values aren’t actually used.
Possible solutions are:
Combine your v and z items into a single piece of text. For example by concatenating them using “|” as a separator. Then afterwards you split the text again using the same character and get back your list.
Instead of running the expression for every value in v or z, run it only once, outputting either 0 or 1. Then use those integers to access a specific data stream.