#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n, s;
        if(!(cin >> n >> s))
            return 0;

        vector<int> num(10);
        for(int i=0; i<10; ++i)
            num[i] = i;

        int ret = 0;
        do{
            int a = 0;
            for(int i=0; i<n; ++i)
                a += num[i] * (i+1);
            if(a == s)
                ++ ret;
        }while(next_permutation(num.begin(), num.end()));

        for(int i=0; i<10-n; ++i)
            ret /= (i+1);
        cout << ret << endl;
    }
}#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int solve(int x, int n, int s, bitset<10>& check){
    if(x == n){
        if(s == 0)
            return 1;
        else
            return 0;
    }

    int ret = 0;
    for(int i=0; i<10; ++i){
        if(check[i])
            continue;
        check[i] = true;
        ret += solve(x+1, n, s-i*(x+1), check);
        check[i] = false;
    }
    return ret;
}

int main()
{
    for(;;){
        int n, s;
        if(!(cin >> n >> s))
            return 0;

        bitset<10> check;
        cout << solve(0, n, s, check) << endl;
    }
}