#include <iostream>
#include <algorithm>
using namespace std;

int fact[] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800 };

int main() {
  unsigned char ary[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  for(int N, S; cin >> N >> S; ) {
    sort(ary, ary + 10);
    int ans = 0;
    do {
      int s = 0;
      for(int i = 0; i < N; ++i) {
        s += (i + 1) * ary[i];
        if(s > S) break;
      }
      if(s == S) ans++;
    } while(next_permutation(ary, ary + 10));
    ans /= fact[10 - N];
    cout << ans << endl;
  }
}