import Data.List

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

comb_of_numseq [n,s]
 | s > 330 = 0
 | otherwise = perms s (map (*) [1..n]) [0..9]
 where
  perms 0 [] _ = 1
  perms 0 [f] cs = if elem 0 cs then 1 else 0
  perms _ [] _ = 0
  perms s' (f:fs) cs = sum [perms s'' fs (delete c' cs) | c'<-cs, let s'' = s' - f c', s''>=0]