Skyrk’s Bar

Skyrk has opened a bar which sells a new kind of beer. Its color is blue, and unlikely most beers, the more you drink, you don’t get drunk, you get smarter! Of course Skyrk’s bar was a widespread success and people all over the world came to taste the vintage. Too much beer makes people go to the bathroom very often, and the bathroom quickly became too crowded. This was especially true for the men’s bathroom, since men have a widely known custom of only using an urinal if it has K empty urinals between him and any other man. This became a problem to Skyrk because despite having several urinals, they couldn’t be all used at the same time. When a man goes to the bathroom, he chooses at random an urinal that is available given men’s picky custom. If there is no spot for him, he gets frustrated and leaves the bar. Skyrk thinks that if the bathroom had N urinals, that would solve the problem. But to be certain, Skyrk devised an experiment: The bathroom starts empty, and men will pick available spots at random until there is no available spot. No man will leave the bathroom in the meantime. What is the expected number of men that can be using the bathroom at the same time when it becomes full? Input The first line contains T (T ≤ 100) — the number of test cases, after this line T test cases follows. Each test case is arranged in a line containing two integers N and K (1 ≤ K ≤ N ≤ 106) — the number of urinals and the number of needed free urinals between any pair of men, correspondingly. Output For each test case print a line containing ‘Case #X: Y’, where X is the case number, starting at 1, and Y is the expected number of men that can be using the bathroom at the same time. Y should be rounded up to 4 digits after the decimal point. The input will be in a way that errors up to 10−5 will still give the correct. answer. Sample Input 3 42 72 10 3 Sample Output Case #1: 1.5000 Case #2: 2.2857 Case #3: 2.4133