#include <iostream>
#include <algorithm>
 
using namespace std;
 
const int MAX = 10;
 
bool used[MAX];
int N, S;
 
int dfs ( int sum, int depth )
{
    if (depth == N) {
        return sum == S;
    }
    int res = 0;
    for (int i = 0; i < MAX; ++i) {
        if (used[i]) { continue; }
        used[i] = true;
        res += dfs(sum + i * (depth+1), depth+1);
        used[i] = false;
    }
    return res;
}
 
int main ( void )
{
    while (cin >> N >> S) {
        fill(used, used+MAX, false);
        cout << dfs(0, 0) << endl;
    }
    return 0;
}