import qualified Data.IntMap as M import Text.Printf main = readLn >>= printf "%.12f" . complete complete :: Int -> Double complete n = M.findWithDefault 0 6 $ foldl dp (M.singleton 0 1) [1..n] dp m k = M.fromListWith (+) (filter (\(k,_) -> k<=6) next) where next = concatMap (\(i,p) -> let j = fromIntegral i in [(i+1, p*((6-j)/6)), (i, p*(j/6))]) $ M.toList m