#include <bits/stdc++.h>
using namespace std;
int n, ans;
vector<int> check;

int dfs(int pos, int sum) {
    if(pos > n) return(0);
    int ret = 0;
    
    if(pos == n) {
        if(sum == ans&&set<int>(check.begin(), check.end()).size() == 3) return(1);
        else           return(0);
    }
    for(int r = 0; r <= 9; r++) {
        check.push_back(r);
        ret += dfs(pos+1, sum+(r*(pos+1)));
        check.pop_back();
    }
    
    return(ret);
}

int main(void) {
    while(cin >> n >> ans) {
        cout << dfs(0, 0) << endl;
    }
    return(0);
}