#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,s;

int check(int x,int y,bool *flg);
int main(void){


    while(cin>>n>>s){
        bool flg[10]={0};
        cout<<check(1,0,flg)<<endl;
    }


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