#include<iostream>
using namespace std;
int a[10],n,s;
int f(int i,int sum)
{
    if(i==n)return sum==s;
    int ans=0;
    for(int j=0;j<10;j++)
    {
        if(a[j])continue;
        if(sum+j*(i+1)>s)break;
        a[j]=1;
        ans+=f(i+1,sum+j*(i+1));
        a[j]=0;
    }
    return ans;
}
main()
{
    while(cin>>n>>s)
    {
        cout<<f(0,0)<<endl;
    }
}
