#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

int n, s, num[10], pattern;
void search(int th) {
  if (th == n) {
    int sum = 0;
    for (int i = 0; i < n; i++)
      sum += num[i] * (i+1);
    if (s == sum) {
      /*                                                                                                                                                                                                    
      for (int j = 0; j < n; j++)                                                                                                                                                                           
        cout << num[j];                                                                                                                                                                                     
      cout << endl;                                                                                                                                                                                         
      */
      pattern++;
    }
  } else {
    bool hoge = false;
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < th; j++)
        if (num[j] == i) {
          hoge = true;
          break;
        }
      if (hoge) {
        hoge = false;
        continue;
      }
      num[th] = i;
      search(th + 1);
    }
  }
}

int main(int argc, char *argv[]) {
  vector<int> result;
  while (cin >> n >> s) {
    pattern = 0;
    search(0);
    result.push_back(pattern);
  }

  for (int i = 0; i < result.size(); i++)
    cout << result[i] << endl;
  return 0;
}