#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int count(int n){
    int i=1;
    int c=0;
    while(i<=n){
        c+=(bool)(i&n);
        i<<=1;
    }
    return c;
}

int main(){
    int n,s;
    while(cin >> n >> s){
        int end = 1<<10;
        int c = 0;
        for(int i=0; i<end; i++){
            if(count(i)!=n) continue;
            vector<int> d;
            d.reserve(n);
            for(int j=0; j<10; j++){
                if((1<<j)&i){
                    d.push_back(j);
                }
            }
            do{
                int ss = 0;
                for(int j=1; j<=n; j++){
                    ss += j*d[j-1];
                    if(ss>s) break;
                }
                if(ss == s) c++;
            } while(next_permutation(d.begin(), d.end()));
        }
        cout << c << endl;
    }
    return 0;
}