def f(i, r, a)
  if i==1
    return a[r] ? 1 : 0
  else
    res = 0
    (0..9).each{|t|
      nr = r - t * i
      break if nr<0
      if a[t]
        a[t] = false
        res += f(i-1, nr, a)
        a[t] = true
      end
    }
    return res
  end
end

while (ln = gets)
  n, s = ln.split.map(&:to_i)
  a = Array.new(10,true)
  puts f(n, s, a)
end


