#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int memo[1<<10][1000];

int ans(int cnt, int f, int s){
  if(s < 0) return 0;
  if(memo[f][s] != -1) return memo[f][s];
  if((cnt == 1) && (s < 10) && ((f&(1<<s))!=0)) return memo[f][s] = 1;
  int ret = 0;
  for(int i=9; i>=0; i--)
    if((f & (1<<i)) != 0)
      ret += ans(cnt-1, f^(1<<i), s-i*cnt);
  return memo[f][s] = ret;
}

int main(){
  int n,s;
  while(cin>>n>>s){
    memset(memo, -1, sizeof(memo));
    if(s >= 1000 || n>10) 
      cout << 0 << endl;
    else
      cout << ans(n, (1<<10)-1, s) << endl;
  }
  return 0;
}