import qualified Data.IntMap.Lazy as M

main :: IO ()
main = interact $ unlines . map (show . comb_of_numseq . map read . words) . lines

comb_of_numseq :: [Int] -> Int
comb_of_numseq [n,s]
 | s > sum (zipWith (*) [n,n-1..1] [9,8..0]) = 0
 | otherwise = length (M.findWithDefault [] s memo)
 where memo = foldr (dp s) (M.fromList [(k,[[k]]) | k<-[0..9]]) [n,n-1..2]

dp :: Int -> Int -> M.IntMap [[Int]] -> M.IntMap [[Int]]
dp s n im = foldr (\i acc -> M.unionWith (++) (next i im) acc) M.empty [0..9]
 where next i = M.map (map (i:) . filter (\v -> notElem i v && length v == n-1)) . M.filterWithKey (\k _ -> k<=s) . M.mapKeys (+ (n*i))