A passenger jet leaves from John C. Munro International Airport in Hamilton, Ontario and flies on a straight path until it reaches its destination. When it begins its flight, it will be seen by the radar tower located at Munro Airport. Along its path, it will pass by other airports, each with its own radar tower. In some cases, the airplane will pass close enough to be seen, in others it won't. Your task is to determine how many radar screens the airplane will appear on during its flight.
The input will contain five sets of data. The first line of each set contains integers , and . Integer corresponds to the airplane's direction of travel in degrees relative to due East (East , North , West , etc.). Integer corresponds to the length of the flight (that is, the distance traveled). Integer corresponds to the number of airports in the area, excluding Munro Airport. The next lines each contain integers , , and giving the coordinates of the airport and the range of its radar tower . Coordinates are relative to Munro Airport, which is assumed to be at location . The axis increases to the East and the axis increases to the North. All units are in kilometers, and you should assume that a radar tower can pick up any object that is at most km away.
Write a program that will read each test case and print out the number of radar towers that will see the jet at some point during its flight.
45 234 3 100 100 25 -100 0 150 250 300 70 120 400 5 100 100 25 -100 120 50 -230 270 70 -250 -250 200 -200 345 10
The jet will appear on 3 radar screens. The jet will appear on 4 radar screens.
Note: Only cases are shown in this sample.
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org