import sys

def f0070(A,n,s):

  if n==1:

    if s in A:f=1

    else:f=0

    return f

  c=0

  A=sorted(A)

  A1=A[:n][::-1]

  A2=A[-n:]

  N=list(range(n))

  def f(A):

    return sum([(i+1)*A[i] for i in N])

  if f(A1)<=s<=f(A2):

    for i in range(len(A)):

      b=s-A[i]*n

      c+=f0070(A[:i]+A[i+1:],n-1,b)

  return c



for a in sys.stdin:

  n,s=list(map(int,a.split()))

  print(f0070(list(range(10)),n,s))
import sys

def f0070(A,n,s):

  if n==1:return s in A

  A=sorted(A)

  A1=A[:n][::-1]

  A2=A[-n:]

  N=list(range(n))

  b1=0

  b2=0

  c=0

  for i in N:

    b1+=(i+1)*A1[i]

    b2+=(i+1)*A2[i]

  if b1<=s<=b2:

    for i in range(len(A)):

      b=s-A[i]*n

      c+=f0070(A[:i]+A[i+1:],n-1,b)

  return c

for a in sys.stdin:

  n,s=list(map(int,a.split()))

  print(f0070(list(range(10)),n,s))
import sys


def f0070(A, n, s):
    if n == 1:
        if s in A:
            f = 1
        else:
            f = 0
        return f
    c = 0
    A = sorted(A)
    A1 = A[:n][::-1]
    A2 = A[-n:]
    N = list(range(n))

    def f(A):
        return sum([(i + 1) * A[i] for i in N])

    if f(A1) <= s <= f(A2):
        for i in range(len(A)):
            b = s - A[i] * n
            c += f0070(A[:i] + A[i + 1 :], n - 1, b)
    return c


for a in sys.stdin:
    n, s = list(map(int, a.split()))
    print(f0070(list(range(10)), n, s))

import sys


def f0070(A, n, s):
    if n == 1:
        return s in A
    A = sorted(A)
    A1 = A[:n][::-1]
    A2 = A[-n:]
    N = list(range(n))
    b1 = 0
    b2 = 0
    c = 0
    for i in N:
        b1 += (i + 1) * A1[i]
        b2 += (i + 1) * A2[i]
    if b1 <= s <= b2:
        for i in range(len(A)):
            b = s - A[i] * n
            c += f0070(A[:i] + A[i + 1 :], n - 1, b)
    return c


for a in sys.stdin:
    n, s = list(map(int, a.split()))
    print(f0070(list(range(10)), n, s))

-        if s in A: -            f = 1 -        else: -            f = 0 -        return f -    c = 0 +        return s in A - -    def f(A): -        return sum([(i + 1) * A[i] for i in N]) - -    if f(A1) <= s <= f(A2): +    b1 = 0 +    b2 = 0 +    c = 0 +    for i in N: +        b1 += (i + 1) * A1[i] +        b2 += (i + 1) * A2[i] +    if b1 <= s <= b2: