#!/usr/local/bin/ruby
rec=Array.new
s=0
while (line=gets)!="0 0\n"
   arr=line.split(" ").map(&:to_i)
   n=arr[0].to_i
   s=arr[1].to_i
   m=0
   (0..9).to_a.combination(n) do |a,b,c,d,e,f,g,h,i|
      if a+b+c==s
         m+=1
      end
   end
   rec.push(m)
   s+=1
end
for i in 0..s
   puts rec[i]
end