### BUGGY CODE ###

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


def solve(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 main(args):

    for line in sys.stdin:
        pick, target = [int(x) for x in line.strip().split(' ')]
        result = solve(pick, target)
        print(result)


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

### FIXED CODE ###

# -*- 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): #  ??¨????????°?????????pick????????°?????????????????????????????????
        temp = []
        #  ?????????????????????????????????n=1?????????????????????????????????eval??§????¨????????¨??????????
        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                 #  n??????????????§???????¨????
        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):
    # zip()????????¨?????????????????????
    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 = 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


def solve4(pick, target, numbers=[0,1,2,3,4,5,6,7,8,9]):
    # ??°??????1?????????????????????????????°????????????????????¨?????§??????????¨???????min, max???????¨?????????????
    # ??????????????????????¨?????????°??????????????¨?????§?????????????????????????????°?????§??????????????§??????????????£?????¨????????§????????????????????¢??????????????????
    # 7.72 [s]
    global Hit
    if pick == 0:
        if target == 0:
            Hit += 1
        return

    for n in numbers:
        lnumbers = numbers[:]   #  ??????????????¨??§????????°???????????????????????§.remove()???????????§?????????????????????????????????????????????
        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????????°????????????????????????????°????????????§???????±???????
    # ???????????°?????????????????????????????????????????????????????????
    if pick == 1:
        return numbers[0] <= target <= numbers[-1]

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

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

    return True


Hit = 0
def solve5(pick, target, numbers=[0,1,2,3,4,5,6,7,8,9]):
    # ??°??????1?????????????????????????????°????????????????????¨?????§??????????¨???????min, max???????¨?????????????
    # ??????????????????????¨?????????°??????????????¨?????§?????????????????????????????°?????§??????????????§??????????????£?????¨????????§????????????????????¢??????????????????
    # 4.16 [s]
    global Hit
    if pick == 1:               #  ?????°????????????????????°???1???????´????????????????pick==1???????????§??????????????????
        if target in numbers:
            Hit += 1
        return

    for n in numbers:
        lnumbers = numbers[:]#  ??????????????¨??§????????°???????????????????????§.remove()???????????§?????????????????????????????????????????????
        lnumbers.remove(n)
        if has_possibility(pick-1, target-(n*pick), lnumbers):
            solve5(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(' ')]
        solve5(pick, target)
        print(Hit)
        Hit = 0

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


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