#include <cstdio>
#include <algorithm>

#define N 10

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int n, s;
  int i;

  while ( scanf ( "%d%d", &n, &s ) == 2 )
  {
    int d[ N ] = { 0 };
    int c = 0;

    for ( i = 1; i <= n; ++i )
    {
      d[ N - i ] = i;
    }

    do
    {
      int r = 0;

      for ( i = 0; i < N; ++i )
      {
        r += i * d[ i ];
      }

      c += !!( r == s );
    }
    while ( next_permutation ( d, d + N ) );

    printf ( "%d\n", c );
  }

  return ( 0 );
}