#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;

map<int,int> dp[11][1024];
int res[11][550];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    dp[0][0][0] = 1;
    for (int i=0; i<11; ++i) {
        for (int j=0; j<1024; ++j) {
            if (dp[i][j].empty()) continue;
            for (auto it = dp[i][j].begin(); it != dp[i][j].end(); ++it) {
                for (int k=0; k<=9; ++k) {
                    if ((j & (1<<k)) == 0) {
                        dp[i+1][j|(1<<k)][it->first + (i+1)*k] += it->second;
                    }
                }
            }
        }
    }

    int n, s;
    while (cin >> n >> s) {
        int res = 0;
        for (int i=0; i<1024; ++i) {
            res += dp[n][i][s];
        }
        cout << res << endl;
    }
    return 0;
}