#include<iostream>
#include<string>
using namespace std;

int main(){
  int n,s;
  int a[10],ans;

  while(cin >> n >> s){
    ans = 0;
    int comb = (1 << n) - 1;
    while(comb < (1<<10)){
      int cnt = 0;
      for(int i=0;i<10;i++){
	if(comb >> i & 1){
	  a[cnt++] = i;
	}
      }
      do{
	int sum = 0;
	for(int i=0;i<n;i++){
	  sum += a[i] * (i+1);
	}
	if(sum == s)ans++;
      }while(next_permutation(a,a+n));
      
      int x = comb & -comb, y = comb + x;
      comb = ( (comb & ~y) / x >> 1 | y);
    }
    cout << ans << endl;
  }
}