main = interact $ unlines . map (show . uncurry comb_of_numseq . read') . lines
 where read' = (\[n,s]->(n,s)) . map read . words

comb_of_numseq n s
 | s > sum (zipWith (*) [9,8..0] [n,n-1..1]) = 0
 | otherwise = length $ filter (\xs -> sum (zipWith (*) [1..n] xs) == s) (perms!!(n-1))

perms  = [perm1,perm2,perm3,perm4,perm5,perm6,perm7,perm8,perm9,perm10]
perm1  = [[x] | x<-[0..9]]
perm2  = [x:p1 | p1<-perm1, x<-[0..9], notElem x p1]
perm3  = [x:p2 | p2<-perm2, x<-[0..9], notElem x p2]
perm4  = [x:p3 | p3<-perm3, x<-[0..9], notElem x p3]
perm5  = [x:p4 | p4<-perm4, x<-[0..9], notElem x p4]
perm6  = [x:p5 | p5<-perm5, x<-[0..9], notElem x p5]
perm7  = [x:p6 | p6<-perm6, x<-[0..9], notElem x p6]
perm8  = [x:p7 | p7<-perm7, x<-[0..9], notElem x p7]
perm9  = [x:p8 | p8<-perm8, x<-[0..9], notElem x p8]
perm10 = [x:p9 | p9<-perm9, x<-[0..9], notElem x p9]