#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;

void dfs(int sum, int count, int S) {
  int i;
  if (sum > s) return;
  if (count == n) {
    if (sum == s) res++;
    return;
  }
  rep(i,10) {
    if (!((1<<i) & S)) {
      dfs(sum + i*(count+1), count+1, S | (1<<i));
    }
  }
}

int main() {
  while (cin >> n >> s) {
    res = 0;
    dfs(0, 0, 0);
    cout << res << endl;
  }
  return 0;
}