#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

int n, s;
bool used[10];
int sum;

int dfs( int t ) {
    if ( sum > s ) {
        return 0;
    }
    if ( t >= n ) {
        return ( sum == s ? 1 : 0 );
    }

    int answer = 0;
    for ( int i = 0; i < 10; i++ ) {
        if ( used[i] ) continue;
        sum += i * ( t + 1 );
        used[i] = true;
        answer += dfs( t + 1 );
        sum -= i * ( t + 1 );
        used[i] = false;
    }
    return answer;
}

int main() {
    while ( cin >> n >> s ) {
        for ( int i = 0; i < 10; ++ i ) used[i] = false;
        sum = 0;
        cout << dfs( 0 ) << endl;
    }
    return 0;
}