#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;
    }
}