import Data.List

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

comb_of_numseq [n,s] = if s > 330 then 0 else f [0..9] 1 n s
 where
  f _ _ 0 0 = 1
  f _ _ 0 _ = 0
  f cs a n s
   | s < 0 = 0
   | last (take n cs) * a > s = 0
   | otherwise = sum $ map (\c -> f (delete c cs) (a+1) (n-1) (s-a*c)) cs