Consider the following diagram. Once every 2 seconds a car enters from the top and travels down towards the exit. Once every 3 seconds a car enters from the left and travels to the right exit. In the beginning there are no cars. On the 2nd second a car will enter at the top. On the 3rd second another car will enter from the left. On the 6th second, cars will enter at both locations and so on. Once a car is on the road it will attempt to move towards its exit location, moving one square per second. If the traffic light is red for the given road then the car will not move and only move when the light is green. If the road is full of cars and a new car cannot enter the road, then an accident happens and everything comes to a stop. Cars that exit are taken off the road. There cannot be more than one car per square.
The traffic lights are broken, so you have been tasked to control them manually. Once per second you can switch the traffic light. If the light is red for the vertical road then it will become green for the horizontal road and vice versa. What is the most number of cars that can reach the exit in 100 seconds?