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

int main() {
  int n,s;
  while(cin >> n >> s) {
    int k=0,ans=0;
    int multiple[10] = {};
    for(int i=1;i<=n;i++) {
      multiple[k] = i;
      k++;
    }
    for(int i=0;i<=9-k;i++) {
      multiple[k+i] = 0;
    }
    sort(multiple,multiple+10);
    do {
      int sum=0;
      for(int i=0;i<10;i++) {
        sum += multiple[i] * i;
      }
      if(s == sum) {
        ans++;
      }
    }while(next_permutation(multiple,multiple+10));
    cout << ans << endl;
    ans = 0;
  }
}