This page is still under construction.

Parts of this page are still being built. What you see may change.

Collecting Every Card

Time limit5sMemory limit512 MB

Summary
Find the expected number of booster packs to buy, each pack giving N distinct kinds, until all C kinds are collected.
Level

Medium7 of 10

Topics
Probability, Dynamic programming, Combinatorics, Math
Solved
No attempts yet

Problem

A new card set has CC different kinds of card. The cards are sold only in booster packs, and each pack holds NN cards whose kinds are all different. The contents of a pack are one of the ways to choose NN kinds out of the CC kinds, and every one of those combinations comes up with the same probability each time you buy a pack.

You buy packs one at a time and keep buying until you own all CC kinds. Compute the expected number of packs you buy.

Input

The first line contains the number of test cases TT. Each of the next TT lines contains CC and NN separated by a space.

Constraints

  • 1≤T≤1001 \le T \le 100
  • 1≤N≤C≤401 \le N \le C \le 40

Output

For each test case, print one line in the following format.

Case #x: E

Here xx is the test case number starting from 1, and EE is the expected number of packs. Round EE at the eighth digit after the decimal point and always print exactly seven digits after the decimal point. A whole number prints as 1.00000001.0000000.

Examples2

  1. Example 1

    Input
    2
    2 1
    3 2
    
    Expected output
    Case #1: 3.0000000
    Case #2: 2.5000000
    
  2. Example 2

    Input
    1
    1 1
    
    Expected output
    Case #1: 1.0000000