#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    vector<int> v;
    for(int i = 0; i <= 9; i++) v.push_back(i);
    
    int n, s;
    while(cin >> n >> s){
        sort(v.begin(), v.end());
        int ans = 0;
        do{
            int tmp = 0;
            for(int i = 0; i < n; i++)  tmp += (i+1)*v[i];
            if(tmp == s)    ans++;
        }while(next_permutation(v.begin(), v.end()));
        
        for(int i = 1; i <= 10-n; i++)  ans /= i;
        
        cout << ans << endl;
    }

    return 0;
}
