#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
bool calc(int n, int s, int *a) {
	int sum = 0;
	rep(i,n) {
		sum += (i+1) * a[i];
	}
	if(sum == s) return true;
	return false;
}
void select(int n, int s, int *a, int len, int &ret) {
	if(len == n) {
		if(calc(n,s,a)) ret++;
		return;
	}
	rep(i,10) {
		if(find(a,a+len,i) == a+len) {
			a[len] = i;
			select(n,s,a,len+1,ret);
		}
	}
}
int main() {
	int n, s;
	while(cin >> n >> s) {
		int a[10];
		int ret = 0;
		select(n,s,a,0,ret);
		cout << ret << endl;
	}
	return 0;
}