import Control.Monad import Text.Printf main :: IO () main = do t <- readLn forM_ [(1::Int)..t] $ \i -> do [a,b] <- liftM (map read . words) getLine ps <- liftM (map read . words) getLine let ans = solve a b ps printf "Case #%d: %.7f\n" i ans solve :: Int -> Int -> [Double] -> Double solve a b ps = minimum $ opt3 : opt2 where opt3 = fromIntegral $ 1 + b + 1 opt2 = do (n, p) <- zip [0..] (scanl (*) 1 ps) return $ fromIntegral (a - n + b - n + 1) + (1 - p) * fromIntegral (b + 1)