#include <algorithm>
#include <iostream>
#define REP(i,n) for(i=0;i<n;i++)
const int K=1024,N=331;
int B[]={1,2,4,8,16,32,64,128,256,512},C[K]={0},D[K][N]={0};
int init(){
    int i,tmp,tmp2,n,dp,i2,j,k;
    REP(i,K){
        REP(j,N)D[i][j]=0;
        tmp=i,tmp2=0,n=0;
        while(tmp){
            n+=tmp&1;
            tmp2++;
            tmp/=2;
        }
        C[i]=n;
        if(n==1)D[i][std::find(B,B+10,i)-B]=1;
        else{
            tmp=i;
            REP(j,tmp2){
                if(tmp&1){
                    dp=n*j,i2=i-B[j];
                    REP(k,N-dp)D[i][k+dp]+=D[i2][k];
                }
                tmp/=2;
            }
        }
    }
    return 0;
}
int main(){
    init();
    int n,s,i,x;
    while(1){
        std::cin>>n>>s;
        if(std::cin.eof())break;
        x=0;
        if(s<N)
            REP(i,K)if(C[i]==n)x+=D[i][s];
        std::cout<<x<<'\n';
    }
}