def calc(arr,n,s)
  return if arr.inject(:+) * @n < @s - s || n>=@n
  arr.each do |i|
    t = s+i*(n+1)
    break if t > @s
    if t==@s && n+1==@n
      @cnt += 1
      break
    end
    calc(arr.reject{|j| i==j},n+1,t)
  end
end

readlines.each do |l|
  @cnt = 0
  @n,@s = l.split.map(&:to_i)
  calc((0..9).to_a, 0, 0)
  puts @cnt
end