#include<iostream>
#include<algorithm>

using namespace std;

bool used[10];

int solve(int x, int y){
    if(x == 0)return y == 0;
    if(y < 0)return 0;
    int res = 0;
    for(int i = 0;i < 10;i++){
	if(used[i])continue;
	used[i] = true;
	res += solve(x - 1, y - x * i);
	used[i] = false;
    }
    return res;
}

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