nums = [0,1,2,3,4,5,6,7,8,9]
while gets
  n,s = $_.split.map(&:to_i)
  ans = 0
  nums.permutation(n).each do |ary|
    sum =0
    c=1
    ary.each do |k|
      sum+=k*c
      if sum > s
        break
      end
      c+=1
    end
    ans+=1 if s == sum
  end
  puts ans
end