import Data.List

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

comb_of_numseq [n,s]
 | s > 330 = 0
 | otherwise = length $ filter ((== s) . sum . zipWith (*) [1..10]) $ perm n [0..9]

perm 0 _ = [[]]
perm n xs = [x:xs' | x<-xs, xs' <- perm (n-1) (delete x xs)]