#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int n, s, cnt;
bool used[10];
void dfs(int size, int sum) {
	if (size == n) {
		if (sum == s)cnt++;
		return;
	}
	rep(i, 10) {
		if (!used[i]) {
			used[i] = true;
			dfs(size + 1, sum + (size + 1)*i);
			used[i] = false;
		}
	}
}
int main() {
	while (~scanf("%d%d", &n, &s)) {
		cnt = 0;
		memset(used, 0, sizeof(used));
		dfs(0, 0);
		printf("%d\n", cnt);
	}
}