#include<iostream>
using namespace std;

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

}

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