#include<iostream>
#include<cstring>
using namespace std;

int solve(int used,int n,int s)
{
    if( n==1)
    {
        if(0<=s&&s<=9 && !((used >> s)&1) ) return 1;
        else return 0;
    }

    int ans =0;
    for(int i=0;i<10;i++)
    {
        if((used>>i)&1)continue;
        else{
            ans += solve(used | 1<<i, n-1, s- n*i);
        }
    }
    return ans;
}

int main()
{
    int n,s;
    while(cin >> n >> s)
    {
        cout << solve( 0,n,s) << endl;
    }

    return 0;
}