#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int const xs[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  
  int n, s;
  while( cin >> n >> s ) {
    int num = 0;
    for( int i=0; i<1024; ++i ) {
      int v[10];
      int nx = 0;
      for( int j=0; j<10; ++j ) {
        if ( i & 1 << j ) {
          v[nx] = xs[j];
          ++nx;
        }
      }
      if ( nx != n )
        continue;

      do {
        int sum = 0;
        for( int j=0; j<n; ++j )
          sum += ( j + 1 ) * v[j];
        if ( sum == s )
          ++num;
      } while( next_permutation( v, v + n ) );
    }
    cout << num << endl;
  }
}