#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n, s;
	while(scanf("%d%d", &n, &s) != EOF){
		if(n > 10){
			puts("0");
			continue;
		}
		int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
		int cnt = 0;
		do{
			int sum = 0;
			rep(i, n) sum += a[i] * (i+1);
			cnt += sum == s;
			reverse(a+n, a+10);
		}while(next_permutation(a, a+10));
		printf("%d\n", cnt);
	}
}