def mx(ls,m):

	global n

	sum = 0

	for i in range(m):

		sum += (n-i)*ls[-i-1]

	return sum



def mn(ls,m):

	global n

	sum = 0

	for i in range(m):

		sum += (n-i)*ls[i]

	return sum

	

def f(ls,m,s):

	global n

	count = 0

	if m > 0:

		vmx,vmn = mx(ls,m),mn(ls,m)

		if vmx < s or vmn > s: return 0

		elif vmx == s or vmn == s: return 1

		for i in range(len(ls)):

			lls = ls[:]

			a = (n-m+1)*lls.pop(i)

			if s-a < 0:	break

			else: count += f(lls,m-1,s-a)

		return count

	else:

		return 1 if s == 0 else 0

			

ls = [i for i in range(10)]

while True:

	try:

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

		print(f(ls,n,s))

	except:

		break
def mxmn(ls,m):

	global n

	s1,s2 = 0, 0

	for i in range(m):

		s1 += (n-i)*ls[-i-1]

		s2 += (n-i)*ls[i]

	return s1,s2



def f(ls,m,s):

	global n

	count = 0

	if m > 0:

		mx,mn = mxmn(ls,m)

		if mx < s or mn > s: return 0

		elif mx == s or mn == s: return 1

		for i in range(len(ls)):

			lls = ls[:]

			a = (n-m+1)*lls.pop(i)

			if s-a < 0:	break

			else: count += f(lls,m-1,s-a)

		return count

	else:

		return 1 if s == 0 else 0

			

ls = [i for i in range(10)]

while True:

	try:

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

		print(f(ls,n,s))

	except:

		break
def mx(ls, m):
    global n
    sum = 0
    for i in range(m):
        sum += (n - i) * ls[-i - 1]
    return sum


def mn(ls, m):
    global n
    sum = 0
    for i in range(m):
        sum += (n - i) * ls[i]
    return sum


def f(ls, m, s):
    global n
    count = 0
    if m > 0:
        vmx, vmn = mx(ls, m), mn(ls, m)
        if vmx < s or vmn > s:
            return 0
        elif vmx == s or vmn == s:
            return 1
        for i in range(len(ls)):
            lls = ls[:]
            a = (n - m + 1) * lls.pop(i)
            if s - a < 0:
                break
            else:
                count += f(lls, m - 1, s - a)
        return count
    else:
        return 1 if s == 0 else 0


ls = [i for i in range(10)]
while True:
    try:
        n, s = list(map(int, input().split()))
        print(f(ls, n, s))
    except:
        break

def mxmn(ls, m):
    global n
    s1, s2 = 0, 0
    for i in range(m):
        s1 += (n - i) * ls[-i - 1]
        s2 += (n - i) * ls[i]
    return s1, s2


def f(ls, m, s):
    global n
    count = 0
    if m > 0:
        mx, mn = mxmn(ls, m)
        if mx < s or mn > s:
            return 0
        elif mx == s or mn == s:
            return 1
        for i in range(len(ls)):
            lls = ls[:]
            a = (n - m + 1) * lls.pop(i)
            if s - a < 0:
                break
            else:
                count += f(lls, m - 1, s - a)
        return count
    else:
        return 1 if s == 0 else 0


ls = [i for i in range(10)]
while True:
    try:
        n, s = list(map(int, input().split()))
        print(f(ls, n, s))
    except:
        break

-def mx(ls, m): +def mxmn(ls, m): -    sum = 0 +    s1, s2 = 0, 0 -        sum += (n - i) * ls[-i - 1] -    return sum - - -def mn(ls, m): -    global n -    sum = 0 -    for i in range(m): -        sum += (n - i) * ls[i] -    return sum +        s1 += (n - i) * ls[-i - 1] +        s2 += (n - i) * ls[i] +    return s1, s2 -        vmx, vmn = mx(ls, m), mn(ls, m) -        if vmx < s or vmn > s: +        mx, mn = mxmn(ls, m) +        if mx < s or mn > s: -        elif vmx == s or vmn == s: +        elif mx == s or mn == s: