@memo = Array.new(10){Array.new(331){ Array.new(1024) }}

def calc(num,n,s)
  return 0 if n<=0 || s<=0 || s>330 || n>10
  return @memo[n][s][num] if @memo[n][s][num]
  ans = 0
  d,m = num.divmod(2)
  cnt = 0
  while d>0 || cnt<10
    if m==0
      t = s-cnt*n
      if t==0 && n-1==0
        ans = 1
        break
      end
      ans += calc(num+2**cnt,n-1,t)
    end
    cnt += 1
    d,m = d.divmod(2)
  end
  @memo[n][s][num] = ans
  return ans
end

while l=gets
  n,s = l.split.map(&:to_i)
  puts calc(0, n, s)
end