# Original solution
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0070
"""
import sys
import time
from itertools import permutations


def solve1(pick, target):
    # ????´???????????????????????????§???????????????????????????
    hit = 0
    for nums in permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], pick):
        temp = []
        for i in range(1, pick+1):
            temp.append('{} * {}'.format(i, nums[0]))
            nums = nums[1:]
        exp = ' + '.join(temp)
        ans = eval(exp)
        if ans == target:
            # print(exp)
            hit += 1
    return hit


def solve2(pick, target):
    # ????????§??????????????£???????????§?????????????????§???????????????
    # 10?????\?????????????????£???????????????????????????
    if target > 330:
        return 0
    hit = 0
    for nums in permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], pick):
        ans = 0
        for i in range(1, pick+1):
            ans += (i * nums[i-1])
            if ans > target:
                break
        if ans == target:
            hit += 1
    return hit


def solve3(pick, target):
    #
    if target > 330:
        return 0
    hit = 0
    for nums in permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], pick):
        temp = [x * y for x, y in zip(nums, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])]
        ans = sum(temp)
        if ans == target:
            hit += 1
    return hit


def calc_min_max(pick, numbers):
    # ?????????????????°???????????¨??????pick????????°????????????????????????????°????????????§????????????
    multiplier =  list(range(1, pick+1))
    min_numbers = numbers[:pick]
    min_numbers.sort(reverse=True)
    temp = [x*y for x, y in zip(min_numbers, multiplier)]
    min = sum(temp)

    numbers = numbers[-pick:]
    temp = [x*y for x, y in zip(numbers, multiplier)]
    max = sum(temp)

    return min, max


Hit = 0
def solve4(pick, target, numbers=[0,1,2,3,4,5,6,7,8,9]):
    # 7.72 [s]
    global Hit
    if pick == 0:
        if target == 0:
            Hit += 1
        return

    for n in numbers:
        lnumbers = numbers[:]
        lnumbers.remove(n)
        p_min, p_max = calc_min_max(pick-1, lnumbers)
        if target-(n*pick) > p_max or target-(n*pick) < p_min:
            continue
        else:
            solve4(pick-1, target-(n*pick), lnumbers)



def main(args):
    global Hit
    for line in sys.stdin:
        pick, target = [int(x) for x in line.strip().split(' ')]
#        start = time.time()
        result = solve2(pick, target)
#        end = time.time()
#        print('solve1({}): {}'.format(end-start, result))

        print(result)

#        solve4(pick, target)
#        print(Hit)
#        Hit = 0



if __name__ == '__main__':
    main(sys.argv[1:])

# Optimized solution
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0070
"""
import sys
import time
from itertools import permutations


def solve1(pick, target):
    # ????´???????????????????????????§???????????????????????????
    hit = 0
    for nums in permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], pick):
        temp = []
        for i in range(1, pick+1):
            temp.append('{} * {}'.format(i, nums[0]))
            nums = nums[1:]
        exp = ' + '.join(temp)
        ans = eval(exp)
        if ans == target:
            # print(exp)
            hit += 1
    return hit


def solve2(pick, target):
    # ????????§??????????????£???????????§?????????????????§???????????????
    # 10?????\?????????????????£??????????????????????????????40.0[s]??\???????????£??????????????§?????§????????????????????????
    if target > 330:
        return 0
    hit = 0
    for nums in permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], pick):
        ans = 0
        for i in range(1, pick+1):
            ans += (i * nums[i-1])
            if ans > target:
                break
        if ans == target:
            hit += 1
    return hit


def solve3(pick, target):
    #
    if target > 330:
        return 0
    hit = 0
    for nums in permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], pick):
        temp = [x * y for x, y in zip(nums, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])]
        ans = sum(temp)
        if ans == target:
            hit += 1
    return hit


def calc_min_max(pick, numbers):
    # ?????????????????°???????????¨??????pick????????°????????????????????????????°????????????§????????????
    multiplier =  list(range(1, pick+1))
    min_numbers = numbers[:pick]
    min_numbers.sort(reverse=True)
    temp = [x*y for x, y in zip(min_numbers, multiplier)]
    min = sum(temp)

    numbers = numbers[-pick:]
    temp = [x*y for x, y in zip(numbers, multiplier)]
    max = sum(temp)

    return min, max


Hit = 0
def solve4(pick, target, numbers=[0,1,2,3,4,5,6,7,8,9]):
    # 7.72 [s]
    global Hit
    if pick == 0:
        if target == 0:
            Hit += 1
        return

    for n in numbers:
        lnumbers = numbers[:]
        lnumbers.remove(n)
        p_min, p_max = calc_min_max(pick-1, lnumbers)
        if target-(n*pick) > p_max or target-(n*pick) < p_min:
            continue
        else:
            solve4(pick-1, target-(n*pick), lnumbers)



def has_possibility(pick, target, numbers):
    # ?????????????????°???????????¨??????pick????????°????????????????????????????°????????????§????????????
    multiplier =  list(range(1, pick+1))
    max_numbers = numbers[-pick:]
    temp = [x*y for x, y in zip(max_numbers, multiplier)]
    max = sum(temp)
    if target > max:
        return False

    min_numbers = numbers[:pick]
    min_numbers.sort(reverse=True)
    temp = [x*y for x, y in zip(min_numbers, multiplier)]
    min = sum(temp)
    if target < min:
        return False

    return True


Hit = 0
def solve5(pick, target, numbers=[0,1,2,3,4,5,6,7,8,9]):
    # 7.72 [s]
    global Hit
    if pick == 0:
        if target == 0:
            Hit += 1
        return

    for n in numbers:
        lnumbers = numbers[:]
        lnumbers.remove(n)
        if has_possibility(pick-1, target-(n*pick), lnumbers):
            solve5(pick-1, target-(n*pick), lnumbers)
        else:
            continue




def main(args):
    global Hit
    for line in sys.stdin:
        global Hit
        pick, target = [int(x) for x in line.strip().split(' ')]
        solve5(pick, target)
        print(Hit)
        Hit = 0
#        start = time.time()
#        result = solve2(pick, target)
#        end = time.time()
#        print('solve1({}): {}'.format(end-start, result))

#    solve5(8, 100)
#    print(Hit)
#    Hit = 0
#    solve5(9, 150)
#    print(Hit)
#    Hit = 0



if __name__ == '__main__':
    main(sys.argv[1:])