#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,s,ans=0;
bool flg[10];
void check(int x,int y);
int main(void){


    while(cin>>n>>s){
        ans = 0;
        for(int i=0;i<10;i++)flg[i]=0;
        check(1,0);
        cout<<ans<<endl;

    }


    return 0;
}
void check(int x,int y){
    if(x==n+1){
        if(y == s)ans++;
        return;
    }
    for(int i=0;i<10;i++){
        if(!flg[i])flg[i]=1,check(x+1,y+(i*x)),flg[i]=0;
    }
    return;
}