#include <iostream>
using namespace std;

int solve(int i, int sum, int flag);

int s, n;
int main() {
   while (!cin.eof()) {
      cin >> n >> s;
      s = solve(0, 0, 0);
      cout << s << endl;
   }
   return 0;
}

int solve(int i, int sum, int flag) {
   int res = 0;
   if (i == n && sum == s) ++res;
   else {
      for (int k = 0; k < 10; k++) {
	 if (flag & 1 << k) continue;
	 res += solve(i + 1, sum + k * (i + 1), flag | 1 << k);
      }
   }
   return res;
}