#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
using namespace std;

bool used[10];

int solve(int n, int s, int k = 0, int sum = 0){
	if(n == k && s == sum){
		return 1;
	}
	if(n < k || s < sum){
		return 0;
	}

	int count = 0;

	for(int i = 0; i < 10; i++){
		if(used[i] != true){
			used[i] = true;
			count += solve(n, s, k+1, sum+i*(k+1));
			used[i] = false;
		}
	}

	return count;
}

int main(){
	int n, s;

	while(cin >> n >> s){
		cout << solve(n, s) << endl;
	}

	return 0;
}