#include <iostream>

using namespace std;

int n, s;

int dfs(int idx, int sum, int bit)
{
    int res = 0;

    if (idx == n) {
        if (sum == s)
            return 1;
        else
            return 0;
    }

    for (int u = 0; u < 10; u++) {
        if (!(bit >> u & 1)) {
            if (sum + (idx + 1) * u <= s)
                res += dfs(idx + 1, sum + (idx + 1) * u, (bit | 1 << u));
        }
    }

    return res;
}

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

    return 0;
}