while True:
    try:
        count = 0
        for i1 in range(10): 
            for i2 in range(10): 
                if i1 == i2:
                    continue
                for i3 in range(10):
                    if i1==i3 or i2==i3:
                        continue
                    for i4 in range(10):
                        if i1==i4 or i2==i4 or i3==i4:
                            continue
                        for i5 in range(10): 
                            if i1==i5 or i2==i5 ori3==i5 or i4==i5:
                                continue
                            for i6 in range(10):
                                if i1==i6 or i2==i6 or i3==i6 or i4==i6 or i5==i6:
                                    continue
                                for i7 in range(10): 
                                    if i1==i7 or i2==i7 or i3==i7 or i4==i7 or i5==i7:
                                        continue
                                    elif i6==i7:
                                        continue
                                    for i8 in range(10):
                                        if i1==i8 or i2==i8 or i3==i8 or i4==i8 or i5==i8:
                                            continue
                                        elif i6==i8 or i7==i8:
                                            continue
                                        for i9 in range(10):
                                            if i1==i9 or i2==i9 or i3==i9 or i4==i9 or i5==i9:
                                                continue
                                            elif i6==i9 or i7==i9 or i8==i9:
                                                continue
                                            for i10 in range(10):
                                                if i1==i10 or i2==i10 or i3==i10 or i4==i10 or i5==i10:
                                                    continue
                                                elif i6==i10 or i7==i10 or i8==i10 or i9==i10:
                                                    continue
                                                wa = i1+2*i2+3*i3+4*i4+5*i5+6*i6+7*i7+8*i8+9*i9+10*i10
                                                if s == wa:
                                                    check = ""
                                                    check += str(i1)+str(i2)+str(i3)+str(i4)+str(i5)
                                                    check += str(i6)+str(i7)+str(i8)+str(i9)+str(i10)
                                                    if check.find(0) == 11 - n:
                                                        count += 1
        print count
    except:
        break

### FIXED CODE ###

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 = map(int, raw_input().split())
		print f(ls,n,s)
	except:
		break