precomputation = [nil]
(1..5).each do |n|
	precomputation << h = Hash.new(0)
	(0..9).to_a.combination(n).map{|t| t.inject(&:+)}.each{|m| h[m] += 1}
end

$<.each_line do |line|
	n, s = line.split.map(&:to_i)
	break if n.zero? and s.zero?

	n, s = 10 - n, 45 - s if 5 < n
	p precomputation[n][s]
end