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

bool used[10];

int rec(int k, int ts, int n, int s) {
    if (n < k) return (ts == s ? 1 : 0);
    if (s < ts) return 0;
    int ret = 0;
    for (int i=0; i<10; ++i) {
        if ( ! used[i]) {
            used[i] = true;
            ret += rec(k+1, ts+k*i, n, s);
            used[i] = false;
        }
    }
    return ret;
}

int main() {
    int n, s;
    while (cin >> n >> s) {
        memset(used, false, sizeof used);
        cout << rec(1, 0, n, s) << endl;
    }
    return 0;
}