Used = Array.new(10).fill(false)

def solve (numRemained, s)
  if numRemained < 1
    return 1 if s == 0
    return 0
  end

  c = 0
  (0...9).each do |i|
    next if Used[i]
    Used[i] = true
    c += solve(numRemained - 1, s - numRemained * i)
    Used[i] = false
  end
  return c
end

while (input = $stdin.gets.chomp) do
  n, s = input.split(" ").map(&:to_i)
  p solve(n, s)
end