How to allocate the column after we choose one of options?

hi all,

I am looking for a way to re-allocate the column after we choose one of the options from one column.

For example:

The first row is my original design
Suppose the second option that users choose the b, and I wanna make the third and fourth columns allocate to like second row or third row in this picture.

like in one of the situations from the option, it does not need the 3rd and 4th columns. Only one is enough (i.e., 3rd). But if users choose other options except for b, it still needs to appear 4 columns in one row.

Is there any idea about this kind of design?

Thank you in advance!