#!/usr/bin/env ruby

while line = gets
  n, s = line.chomp!.split.map(&:to_i)

  nums = (0..9).to_a.permutation(n)

  cnt = 0
  nums.each do |ary|
    sum = 0
    (1..n).each { |i| sum += ary[i - 1] * i }
    cnt += 1 if sum == s
  end
  puts cnt

end