Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets.
A single data set has 4 components:
- Start Line - A single line:
START L W D
where (1 <= (L,W,D) <= 20). L is the length of the bayou along the x-axis, W is the width of the bayou along the y-axis, and D is the depth of the bayou on the z-axis.
- Dynamite List - A single line containing a space-separated list of 1 to 10 data elements. Each element contains the location and fuse length of a single stick of dynamite as it is dropped into the bayou formatted as:
x,y,f
x and y give the surface coordinates of the drop where (0 <= x <= L) and (0 <= y <= W). f is the length of the fuse and is in the range (0 <= f <= 30).
- Fish List - A single line containing a space-separated list of 1 to 15 data elements. Each element represents the location of a fish in the bayou formatted as:
x,y,z
where (0 <= x <= L), (0 <= y <= W), and (0 <= z <= D), where z = 0 indicates the fish is at the surface of the water.
- End line A single line:
END
After the last data set, there will be a single line:
ENDOFINPUT
Note:
All numeric values will be given as integers.
The dynamite drops at a constant speed from the top of the bayou (z = 0).
The fuse burns up one unit of its length in precisely the amount of time it takes the dynamite to sink one unit deeper into the bayou.
If the dynamite reaches the bottom of the bayou before the fuse runs out, it will stay there until it detonates.
Multiple fish will not occupy the same position.
Fish are killed if their distance from any dynamite explosion is <= 1.