Here is a different approach, where you can use the same code for different masks.
Designer:
multi_mask_input.aia (7.0 KB)
Sample run:

Blocks:
Here is a different approach, where you can use the same code for different masks.
Designer:
Sample run:

Blocks: