#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<int,int>,int >ma;//sum,number, count
void dfs(int cur,int used,ll status){
    if(cur>10000)return;
    if(used>10){
        return;
    }
    ma[make_pair(cur, used)]++;
    used++;
    for(int j=0;j<=9;j++){
        if(((status>>j)&1ll)==0ll)
            dfs(cur+used*j,used,(status|(1ll<<j)));
    }
}
int main(){
    dfs(0,0,0);
    while(cin>>n>>s){
        int ans=0;
        ans=ma[make_pair(s, n)];
        cout<<ans<<endl;
    }
    return 0;
}