#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int n,s;
bool used[10];
int cnt;

int LIMIT(){
  int a = 0,b = 0,c = 9;
  for(int i = 0 ; i < n ; i++){
    a += (i+1)*c;
    c--;
  }

  c = 9-n+1;
  for(int i = 0 ; i < n ; i++){
    b += (i+1) * c;
    c++; 
  }

  return max(a,c);
}

int solve(int k,int sum,int lim){
  if(sum > s || sum > lim) return 0;

  if(n == k){
    if(sum == s){
      return 1;
    }
    return 0;
  }

  int res = 0;
  for(int i = 0 ; i <= 9 ; i++){
    if(!used[i]){
      used[i] = true;
      res += solve(k + 1 , sum + ((k+1)*i),lim);
      used[i] = false;
    }
  }  

  return res;
}

int main(){
  while(cin >> n >> s){
    int lim = LIMIT();

    if(lim < s){
      cout << "0" << endl;
      continue;
    }

    cnt = 0;
    memset(used,false,sizeof(used));
    cout << solve(0,0,lim) << endl;
  }
  
  return 0;
}