#include <bits/stdc++.h>
using namespace std;

int dp[11][331][1024];

int main()
{
	dp[0][0][0] = 1;
	for (int i = 0; i < 10; i++){
		for (int j = 0; j <= 330; j++){
			for (int k = 0; k < 1024; k++){
				if (dp[i][j][k]){
					for (int l = 0; l <= 9; l++){
						if ((~k) & (1 << l)){
							dp[i + 1][j + (i + 1) * l][k | (1 << l)] += dp[i][j][k];
						}
					}
				}
			}
		}
	}
	
	int n, s;
	while (scanf("%d %d", &n, &s) != EOF){
		if (s > 330){
			puts("0");
			continue;
		}
		
		int sum = 0;
		for (int i = 0; i < 1024; i++){
			sum += dp[n][s][i];
		}
		printf("%d\n", sum);
	}
	
	return 0;
}