#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<string.h>
#include<queue>
#include<math.h>
#include<set>
#include<unordered_set>
#include<limits.h>
using namespace std;

typedef unsigned long long ll;
int n,s;
map<pair<pair<int,int>,int>,int >ma;
int dfs(int need,int used,ll status){
    if(need<0)return 0;
    if(used==n){
        if(need==0)
            return 1;
        else return 0;
    }
    if(ma[make_pair(make_pair(need, used), status)]){
        return ma[make_pair(make_pair(need, used), status)];
    }
    int ret=0;
    used++;
    for(int j=0;j<=9;j++){
        if(((status>>j)&1ll)==0ll)
            ret+= dfs(need-used*j,used,(status|(1ll<<j)));
    }
    ma[make_pair(make_pair(need, used-1), status)] = ret;
    return ret;
}
int main(){
    while(cin>>n>>s){
        int ans=0;
        ll st=0;
        ans=dfs(s,0,st);
        cout<<ans<<endl;
    }
    return 0;
}