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) $ candidate n s

candidate x s = perms 0 (map (*) [1..x]) [0..9]
 where
  perms acc [] _ = [acc]
  perms s' (f:fs) cs = concat [perms s'' fs (delete c' cs) | c'<-cs, let s'' = s' + f c', s''<=s]