To move the racks in the same direction, use an even number of gears to connect them. To move the racks in opposite directions, use an odd number of gears.
Use as many gears as you need to move the racks. Notice that when a gear turns in a clockwise direction, the gear next to it turns counter-clockwise.