Detect 4 layer

i am creating a prototype using protopie software. i have 4 layers named 1, 2, 3, 4 and in each layer there will be 1 layer named bg1, bg2, bg3, bg4. i have a layer named pop-up and another layer named overlay.

the default opacity state of each layer bg1, bg2, bg3, bg4 is 0 and the opacity state of each layer bg1, bg2, bg3, bg4 can only be changed to 100 when clicking on a specific element in layer 1, 2, 3, 4. the default opacity state of the pop-up layer and overlay layer is 0.

i want the pop-up layer and overlay layer to be converted to opacity state 100 when all 4 layers bg1, bg2, bg3, bg4 have opacity state 100. please guide me how to do it in detail