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

int n, s;

int dfs(int bit = 0, int cnt = 0, int sum = 0) {
  if (cnt == n) return s == sum;

  int ret = 0;

  for (int i = 0; i < 10; ++i) {
    if ((1 << i) & bit) continue;
    ret += dfs(bit + (1 << i), cnt + 1, sum + (cnt + 1) * i);
  }

  return ret;
}

int main() {
  while (cin >> n >> s) {
    cout << dfs() << endl;
  }
}