Using a switch, branches and gates after each other

As DJMidKnight pointed out, the branches aren’t necessary. This will do what you want (just tested it):