#include <iostream>
#include <algorithm>


#define M 10

using namespace std;

int NUM[M]={0,1,2,3,4,5,6,7,8,9};
int ans;

int Combination(int n, int i, int j, int kumi[M]){
    if(i==n){
        int ret=0;
        do{
            int s=0;
            int k=1;
            for(int c=0; c<n; c++){
                s+=k*kumi[c];
                k++;
            }
            if(ans==s)ret++;
        }while(next_permutation(kumi, kumi+n));
        
        return ret;
    }
    if(j==M){
        return 0;
    }
    int ret1,ret2;
    ret1=Combination(n, i, j+1, kumi);
    kumi[i]=NUM[j];
    ret2=Combination(n, i+1, j+1, kumi);
    return ret1+ret2;
}

int main()
{
    int kumi[M]={0};
    int n;
    while(cin>>n>>ans){
        cout<<Combination(n,0,0,kumi)<<endl;
    }
    return 0;
}