#include<iostream>
#include<cstring>
using namespace std;
int dp[1<<10][300];

int solve(int used,int n,int s)
{
    if(dp[used][s]!= -1) return dp[used][s];
    //cout << n << " " << s << endl;
    if( n==1)
    {
        if(0<=s&&s<=9 && !((used >> s)&1) ){dp[used|(1<<n)][s] = 1; return 1;}
        else{dp[used|(1<<n)][s]=0;  return 0;}
    }

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

int main()
{
    int n,s;
    while(cin >> n >> s)
    {
        memset(dp,-1,sizeof(dp));
        cout << solve( 0,n,s) << endl;
    }

    return 0;
}