A.	VARIABLE

	A road from the north and another from the south come together
	to form a single road for a while, then branch off into north
	and southbound roads again.  Cars arrive from the north every
	10 seconds normally distributed with a std of 2.  60% of these
	will travel southbound when the road branches, while the rest
	travel northbound.  Cars from the south arrive every 8 seconds
	normally distributed with a std of 3.  70% of these will travel
	northbound while the rest head south after the road branches.
	The time it takes for any car to travel the section of conjoined
	road is 60 seconds plus 2 seconds for every car on that section.

	Tabulate the transit times for all cars that come from the north and
	travel south during the time it takes for 100 cars coming from the
	south to travel northbound out of the system.

	SIMULATE

 NTOS	TABLE		M1,60,10,8
 NORTH	VARIABLE	1
 SOUTH	VARIABLE	2
 DTIME	VARIABLE	60+Q(ROADQ)*2

	GENERATE	RVNORM(2,10,2)		Cars arrive from north
	ASSIGN		FROM,V$NORTH
	TRANSFER	.60,GON,GOS		60% heading south

	GENERATE	RVNORM(2,8,3)		Cars arrive from south
	ASSIGN		FROM,V$SOUTH
	TRANSFER	.70,GOS,GON		70% heading north

 GON	ASSIGN		DEST,V$NORTH
	TRANSFER	,ROAD
 GOS	ASSIGN		DEST,V$SOUTH

 ROAD	QUEUE		ROADQ			Drive over the road
	ADVANCE		V$DTIME			Calculate drive time
	DEPART		ROADQ			Get off road

	TEST E		P(DEST),V$NORTH,SOUTH	Exit north?
 NORTH	TEST E		P(FROM),V$SOUTH,IGNORE	Came from south?
	TERMINATE	1			Count it!

 SOUTH	TEST E		P(FROM),V$NORTH,IGNORE	Exit south!
	TABULATE	NTOS

 IGNORE	TERMINATE


	START		100
	END
