#include <iostream>
#include <array>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
  int const xs[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  map<int, int> m[11];
  for( int i=0; i<1024; ++i ) {
    int n = 0;
    array<int, 10> t;
    for( int j=0; j<10; ++j ) {
      if ( i & 1 << j ) {
        t[n++] = xs[j];
      }
    }
    do {
      int sum = 0;
      for( int j=0; j<n; ++j )
        sum += ( j + 1 ) * t[j];
      ++m[n][sum];
    } while( next_permutation( t.data(), t.data() + n ) );
  }


  int n, s;
  while( cin >> n >> s ) {
    cout << m[n][s] << endl;
  }
}