1 #include <iostream>
2 #include <cstdio>
3 #include <cmath>
4 #include <cstring>
5 #include <algorithm>
6 #include <queue>
7 #include <stack>
8 #include <vector>
9 using namespace std;
10 struct node
11 {
12 double x,y;
13 };
14 bool cmp(const node &a,const node &b)
15 {
16 return a.y<b.y;
17 }
18 int main(int argc, char *argv[])
19 {
20 int n,d;
21 int ans=0;
22 node a[1100];
23 while(scanf("%d%d",&n,&d)!=EOF)
24 {
25 ans++;
26 if(n==0&&d==0)
27 break;
28 int x,y;
29 double t;
30 int flag=0;
31 for(int i=0;i<n;i++)
32 {
33 scanf("%d%d",&x,&y);
34 if(y>d)
35 flag=1;
36 t=sqrt(d*d*1.00-y*y*1.00);
37 a[i].x=x-t;a[i].y=x+t;
38 }
39 if(flag||d<0)
40 {
41 printf("Case %d: -1\n",ans);
42 continue;
43 }
44 sort(a,a+n,cmp);
45 t=a[0].y;
46 int sum=1;
47 for(int i=0;i<n;i++)
48 {
49 if(a[i].x>t)
50 {
51 sum++;
52 t=a[i].y;
53 }
54 }
55 printf("Case %d: %d\n",ans,sum);
56 }
57 return 0;
58 }