def calc(n,s)
	a = (1..n).to_a
	q = (0..9).to_a.permutation(n).map do |c| 
		[] if c[n-1]*n > s
		c.map!.with_index{|x,i| x*a[i]}
	end
	p q.count{|p| p.inject{|x,y| x+y} == s}
end

readlines.each do |l|
	n,s = l.split.map(&:to_i)
	calc(n,s)
end