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

int dp[1 << 10][15000];
int main() {
	int n, s;
	while (~scanf("%d%d", &n, &s)) {
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
		int ans = 0;
		rep(i, 1 << 10) {
			rep(j, s + 1) {
				if (!dp[i][j])continue;
				int cnt = 0;
				rep(k, 10) {
					if ((i >> k) & 1)cnt++;
				}
				if (cnt == n) {
					if (j == s)ans += dp[i][j];
					continue;
				}
				rep(k, 10) {
					if (!((i >> k) & 1)) {
						dp[i | (1 << k)][j + k*(cnt + 1)] += dp[i][j];
					}
				}
			}
		}
		printf("%d\n", ans);
	}
}