import Data.List

countEqn :: [Int] -> Int
countEqn xs = (!! last xs) $ foldl' step initDP $ tail lhss
    where lhss = init xs
          initial = head xs
          initDP = (replicate initial 0) ++  [1] ++ (replicate (20 - initial) 0)
          step dp k = let zeros = replicate k 0
                          in zipWith (+) (drop k dp ++ zeros) (zeros ++ dp)

main :: IO ()
main = getLine >> getLine >>= print . countEqn . map read . words