#include <iostream>
using namespace std;

int s, ret;
int usedInt [10] = {
    0,0,0,0,0,0,0,0,0,0
};
void dfs(int n, int num)
{
    if(n == 0)
    {
        if(num == s) ret++;
        else return;
    }
    for(int i=0; i<10; ++i)
    {
        if(usedInt[i] == 0)
            usedInt[i] = 1;
        else
            continue;
        
        dfs(n-1, num+i*n);
        usedInt[i] = 0;
    }
}



int main()
{
    int n;
    while(1)
    {
        cin >> n >> s;
        dfs(n, 0);
        cout << ret << endl;
    }
}