import Control.Applicative import Data.List import Data.Array repeated_combination ns n = comb n [(ns,[])] where comb 0 xs = [a|(_,a)<-xs] comb c xs = comb (c-1) $ concatMap f xs f (xs,ys) = [(as,ys++[a])|as@(a:_)<-tails xs] main = do n <- (80-).read <$> getLine [a,b,c] <- map ((/100).read) . words <$> getLine let pa n m | m==0 || m==n+1 = 1 | n==1 && m==1 = a | m==1 || m==n = b | otherwise = c sub nn m [i,j] = foldl (*) ((dp!(nn,(j-i+1)))*(pa m (i-1))*(pa m (j+1))) $ map ((1-).(pa m)) [i..j] calc 0 m = fromIntegral m calc nn m = foldl1 (+) $ map (sub (nn-1) m) $ repeated_combination [1..m] 2 dp = array ((0,0),(n,14)) [((i,j),calc i j)|i<-[0..n],j<-[0..14]] in print $ (dp!(n,14))*2