#include <iostream>
#include <cstring>

using namespace std;

const int N = 10;
const int S = 330+1; // 作れる値の最大値+1
int dp[S][N][1<<N];  // 作る値, 残り個数, 今迄どれを使ったか

int solve(int n, int s, int used) {
    //cout << n << ' ' << s << ' ' << used << endl;
    if (s < 0) return 0;
    if (n == 0) {
        if (s == 0) return 1;
        return 0;
    }
    if (dp[n][s][used] != -1) return dp[n][s][used];
    int cnt = 0;
    for (int i = 0; i <= 9; i++) {
        if (used & (1<<i)) continue;
        //cout << "used " << i << endl;
        cnt += solve(n-1, s - i*n, used | (1<<i));
    }
    return dp[n][s][used] = cnt;
}

void init() {
    memset(dp, -1, sizeof(dp));
}

int main() {
    int n, s;
    init();
    while (cin >> n >> s) {
        if (s >= S) {
            cout << 0 << endl;
            continue;
        }
        cout << solve(n, s, 0) << endl;
    }
    return 0;
}