#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int dp[10+1][10000];
int memo[10];

void rec(int size, int depth, int sum) {
	if (size + 1 == depth) {
		dp[size][sum]++;
	} else {
		for (int i = 0; i <= 9; i++) {
			if (memo[i] == 0) {
				memo[i] = 1;
				rec(size, depth + 1, sum + i * depth);
				memo[i] = 0;
			}
		}
	}
}

int main() {
	memset(dp, 0, sizeof(dp));

	for (int i = 1; i <= 10; i++) {
		memset(memo, 0, sizeof(memo));
		rec(i, 1, 0);
	}

	int n, s;
	while (cin >> n >> s) {
		cout << dp[n][s] << endl;
	}
	return 0;
}