#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
#define INF 1e9
#define MAX_SIZE 100
int graph[MAX_SIZE + 1][MAX_SIZE + 1], n, mapping[MAX_SIZE + 1];
int main() {
int u, v, flag=0, testCase = 1;
while(scanf("%d%d", &u, &v), u||v){
for(int i = 1; i <= MAX_SIZE; i++) {
for(int j = 1; j <= MAX_SIZE; j++) {
graph[i][j] = INF;
}
graph[i][i] = 0;
}
int n = 0;
memset (mapping, 0, sizeof(mapping));
do {
if (!mapping[u])
mapping[u] = ++n;
if (!mapping[v])
mapping[v] = ++n;
graph[mapping[u]][mapping[v]] = 1;
} while(scanf("%d%d", &u, &v), u||v);
for(int k = 1; k <= n; k++)
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
double s = 0.0;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++)
s += graph[i][j];
//cout<<s<<endl;
s /= (double)n*(n-1);
//cout<<s<<endl;
printf("Case %d: average length between pages = %.3lf clicks\n",testCase++,s);
}
return 0;
}
IAkjaW5jbHVkZSA8Y3N0ZGlvPgogICAgI2luY2x1ZGUgPGFsZ29yaXRobT4KICAgICNpbmNsdWRlIDxjc3RyaW5nPgogICAgI2luY2x1ZGUgPGlvc3RyZWFtPgogICAgCiAgICB1c2luZyBuYW1lc3BhY2Ugc3RkOwogICAgCiAgICAjZGVmaW5lIElORiAxZTkKICAgICNkZWZpbmUgTUFYX1NJWkUgMTAwCgkKCWludCBncmFwaFtNQVhfU0laRSArIDFdW01BWF9TSVpFICsgMV0sIG4sIG1hcHBpbmdbTUFYX1NJWkUgKyAxXTsKCWludCBtYWluKCkgewoJCWludCB1LCB2LCBmbGFnPTAsIHRlc3RDYXNlID0gMTsKICAgIAl3aGlsZShzY2FuZigiJWQlZCIsICZ1LCAmdiksIHV8fHYpewogICAgICAgICAgICBmb3IoaW50IGkgPSAxOyBpIDw9IE1BWF9TSVpFOyBpKyspIHsKICAgICAgICAgICAgCWZvcihpbnQgaiA9IDE7IGogPD0gTUFYX1NJWkU7IGorKykgewogICAgICAgICAgICAgICAgCWdyYXBoW2ldW2pdID0gSU5GOwogICAgICAgICAgICAJfQogICAgICAgICAgICAJZ3JhcGhbaV1baV0gPSAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGludCBuID0gMDsKICAgICAgICAgICAgbWVtc2V0IChtYXBwaW5nLCAwLCBzaXplb2YobWFwcGluZykpOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgIAlpZiAoIW1hcHBpbmdbdV0pCiAgICAgICAgICAgIAkJbWFwcGluZ1t1XSA9ICsrbjsKICAgICAgICAgICAgCWlmICghbWFwcGluZ1t2XSkKICAgICAgICAgICAgCQltYXBwaW5nW3ZdID0gKytuOwogICAgICAgICAgICAJZ3JhcGhbbWFwcGluZ1t1XV1bbWFwcGluZ1t2XV0gPSAxOwogICAgICAgICAgICB9IHdoaWxlKHNjYW5mKCIlZCVkIiwgJnUsICZ2KSwgdXx8dik7CiAgICAgICAgICAgIAogICAgICAgICAgICBmb3IoaW50IGsgPSAxOyBrIDw9IG47IGsrKykKCSAgICAgICAgICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKQogICAgCQkgICAgICAgIGZvcihpbnQgaiA9IDE7IGogPD0gbjsgaisrKQogICAgICAgICAgICAJCSAgICBncmFwaFtpXVtqXSA9IG1pbihncmFwaFtpXVtqXSwgZ3JhcGhbaV1ba10gKyBncmFwaFtrXVtqXSk7CgogICAgICAgIAlkb3VibGUgcyA9IDAuMDsKICAgICAgICAgICAgZm9yKGludCBpID0gMTsgaSA8PSBuOyBpKyspCiAgICAgICAgICAgIAlmb3IoaW50IGogPSAxOyBqIDw9IG47IGorKykKICAgICAgICAgICAgCQlzICs9IGdyYXBoW2ldW2pdOwogICAgICAgICAgICAvL2NvdXQ8PHM8PGVuZGw7CiAgICAgICAgICAgIHMgLz0gKGRvdWJsZSluKihuLTEp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90 90 12 12 89 89 13 13 88 88 14 14 87 87 15 15 86 86 16 16 85 85 17 17 84 84 18 18 83 83 19 19 82 82 20 20 81 81 21 21 80 80 22 22 79 79 23 23 78 78 24 24 77 77 25 25 76 76 26 26 75 75 27 27 74 74 28 28 73 73 29 29 72 72 30 30 71 71 31 31 70 70 32 32 69 69 33 33 68 68 34 34 67 67 35 35 66 66 36 36 65 65 37 37 64 64 38 38 63 63 39 39 62 62 40 40 61 61 41 41 60 60 42 42 59 59 43 43 58 58 44 44 57 57 45 45 56 56 46 46 55 55 47 47 54 54 48 48 53 53 49 49 52 52 50 50 51 51 1 0 0
0 0