#include <iostream>
using namespace std;

void solve(int c, int sum);

int n, s, list[11][331], judge[10];
int main() {
   solve(1, 0);
   while (cin >> n >> s) {
      cout << list[n][s] << endl;
   }
   return 0;
}

void solve(int c, int sum) {
   if (c == 11) return;
   for (int i = 0; i < 10; i++) {
      if (!judge[i]) {
	 judge[i] = 1;
	 ++list[c][sum + i * c];
	 solve(c + 1, sum + i * c);
	 judge[i] = 0;
      }
   }
}