With no restrictions on the route, the number of routes from H to O is , since this is the number ways in which the positions of the 6 easterly 'legs' of the journey may be positioned within the 15 legs that make up the whole journey.
The number of routes from H to A is similarly and the number of routes from B to O is . Thus the number of routes from H to O via A and B is . These represent the routes that are not available if AB is closed.
So the number of available routes that don't go via A and B .