#include <iostream>
#include <cstring>

using namespace std;

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

void solve(int k,int sum){
  if(sum > s) return;

  if(n == k){
    if(sum == s){
      cnt++;
    }
    return;
  }

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

int main(){
  while(cin >> n >> s){
    cnt = 0;
    memset(used,false,sizeof(used));
    solve(0,0);
    cout << cnt << endl;
  }

  return 0;
}