#include <iostream>
#include <algorithm>

using namespace std;

int dfs(int sub, int depth, int N, int S, int *used) {
    if(depth == N) {
        if(sub == S) return 1;
        else return 0;
    }
    int cnt = 0;
    for(int i = 0; i <= 9; ++i) {
        if(used[i]) continue;
        int s = sub + i*(depth+1);
        if(s <= S) {
            used[i] = 1;
            cnt += dfs(s, depth+1, N, S, used);
            used[i] = 0;
        }
    }
    return cnt;
}

int main() {
    int N, S;
    while(cin >> N >> S) {
        int used[10] = {0};
        cout << dfs(0, 0, N, S, used)  << endl;
    }
    return 0;
}