#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <algorithm>
using namespace std;

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

int n, s;
int res;

bool isContain(const vector<int>& v, int a) {
  int i, vsz = v.size();
  rep(i,vsz) if (v[i] == a) return true;
  return false;
}

void dfs(vector<int> v) {
  int i, vsz = v.size(), sum = 0;
  if (vsz == n) {
    rep(i,vsz) sum += v[i]*(i+1);
    if (sum == s) res++;
    return;
  }
  rep(i,10) if(!isContain(v,i)) {
    vector<int> vv = v;
    vv.push_back(i);
    dfs(vv);
  }
}

int main() {
  while (scanf("%d %d", &n, &s) != EOF) {
    res = 0;
    dfs(vector<int>());
    cout << res << endl;
  }
  return 0;
}