#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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()
const int INF = 1<<29;

int main() {
  int n,s;
  while(cin>>n>>s) {
    if (n > 10) {cout << 0 << endl; continue;}
    int res = 0;
    int comb = (1<<n) - 1;
    while (comb < 1 << 10) {
      vector<int> v;
      REP(i,10) {
        if ((comb>>i) & 1) {
          v.push_back(i);
          //    cout << i <<" ";
        }
      }
//      cout << endl;
      do {
        int hoge = 0;
        REP(i, n) {
          hoge += v[i] * (i+1);
        }
        if (hoge == s) res++;
      } while(next_permutation(ALL(v)));
      
      int x = comb & -comb, y = comb + x;
      comb = ((comb & ~y) / x >> 1) | y;
    }
    cout << res << endl;
  }
}