#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int ans[10][331]={0};
int tmp;
int n,s;
int f[10];
int main(void){
  f[0] = 1;
  f[1] = 1;
  FOR(i,2,10){
    f[i] = f[i-1] * i;
  }
  int a[10] = {0,1,2,3,4,5,6,7,8,9};
  do{
    tmp=0;
    REP(i,10){
      tmp += (i+1)*a[i];
      ans[i][tmp]++;
    }
  }while(next_permutation(a,a+10));
  while(cin>>n>>s){
    if(s>330) cout<<0<<endl;
    else cout<<ans[n-1][s]/f[10-n]<<endl;
  }
  return 0;
}