Collecting Every Card

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

Medium7ProbabilityDynamic programmingCombinatoricsMathNo attempts yetTime limit5sMemory limit512 MB

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

  • 1T1001 \le T \le 100
  • 1NC401 \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.