#include <bits/stdc++.h>

using namespace std;

int n, s;
int dp[1024][1000][10];

int solve(int stat, int sum, int cnt) {

    if(dp[stat][sum][cnt] != -1) return dp[stat][sum][cnt];

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

    int ret = 0;

    for(int i = 0; i <= 9; ++i) {
        if(!(stat & 1 << i)) {
            ret += solve(stat | 1 << i, sum + i * (cnt + 1), cnt + 1);
        }
    }

    return dp[stat][sum][cnt] = ret;

}

int main() {

    while(cin >> n >> s) {

        memset(dp, -1, sizeof(dp));
        cout << solve(0, 0, 0) << endl;

    }

}