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:

		if mx(ls,m) < s or mn(ls,m) > s: return 0

		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 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:
        if mx(ls, m) < s or mn(ls, m) > s:
            return 0
        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

-        if mx(ls, m) < s or mn(ls, m) > s: +        vmx, vmn = mx(ls, m), mn(ls, m) +        if vmx < s or vmn > s: +        elif vmx == s or vmn == s: +            return 1