#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 dp[1<<10][331] = {{0}};
	int ans[11][331] = {{0}};
	dp[0][0] = 1;
	ans[0][0] = 1;

	rep(i, 1<<10){
		int stand = 0, tmp = i;
		while(tmp){
			stand += tmp&1;
			tmp >>= 1;
		}

		rep(j, 331){
			rep(k, 10){
				if((i>>k)&1 && j-stand*k>=0){
					int inc = dp[i^(1<<k)][j-stand*k];
					dp[i][j] += inc;
					ans[stand][j] += inc;
				}
			}
		}
	}

	int n, s;
	while(scanf("%d%d", &n, &s) != EOF){
		if(n < 0 || 10 < n)
			puts("0");
		else
			printf("%d\n", 0<=s && s<=330 ? ans[n][s] : 0);
	}
}