#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;
int memo[11][1024][332];

int solve( int t, int state, int sum ) {
    if ( sum > s ) return 0;
    if ( t == n + 1 ) return sum == s;
    int answer = 0;
    for ( int i = 0; i < 10; i++ ) {
        if ( state & ( 1 << i ) ) continue;
        answer += solve( t + 1, state | ( 1 << i ), sum + i * t );
    }
    return memo[t][state][sum] = answer;
}

int main() {
    int i, j, k;
    bool first = true;
    while ( scanf( "%d%d", &n, &s ) != EOF ) {
        if ( first ) goto solve;
        for ( i = 0; i < 10; i++ ) {
            for ( j = 0; j < 1024; j++ ) {
                for ( k = 0; k < 332; k++ ) {
                    memo[i][j][k] = 0;
                }
            }
        }
    solve:;
        first = false;
        printf( "%d\n", ( s > 331 ? 0 : solve( 1, 0, 0 ) ) );
    }
    return 0;
}