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 (\(x,_,xs) -> x==s && length xs == n) $ dfs next (0,1,[])
 where
  dfs f x = x:(f x >>= dfs f)
  next (s',a,acc) = [(s'',a+1,x:acc) | x <- ([0..9] \\ acc), let s''=s'+a*x, s''<=s]