1 import java.io.*;
2 import java.util.Scanner;
3
4 class firefly {
5
6 public static void main( String[] args ) throws Exception {
7 String inFile = args.length > 0 ? args[0] : "firefly.in";
8 Scanner in = new Scanner( new File( inFile ) );
9 double s = in.nextInt();
10 double x = in.nextInt();
11 double y = in.nextInt();
12 int n = 0;
13
14 while ( s > 0 ) {
15 n++;
16 int fx = in.nextInt();
17 int fy = in.nextInt();
18 boolean caught = false;
19 while ( fx >= 0 ) {
20 double d = Math.sqrt( (fx-x)*(fx-x) + (fy-y)*(fy-y) );
21 if ( d - s <= 1 && !caught ) {
22 System.out.format( "Firefly %d caught at (%d,%d)%n", n, fx, fy );
23 caught = true;
24 if ( d - s > 0.999 ) System.err.format( "Borderline! D=%f%n", d - s );
25 }
26 else if ( !caught ) {
27 x = x + s/d * (fx-x);
28 y = y + s/d * (fy-y);
29 }
30 fx = in.nextInt();
31 fy = in.nextInt();
32 }
33 if ( !caught ) {
34 System.out.format( "Firefly %d not caught%n", n );
35 }
36 s = in.nextDouble();
37 x = in.nextInt();
38 y = in.nextInt();
39 }
40 }
41
42 }