#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int N, S;
    while(cin >> N >> S) {
        int pats[10];
        for(int i = 0; i < 10; ++i) pats[i] = i<N ? 1 : 0;
        reverse(pats, pats+10);

        int ans = 0;
        do {
            int list[N], *pt = list;
            for(int i = 0; i < 10; ++i)
                if(pats[i]) *pt++ = i;

            do {
                int sum = 0;
                for(int i = 0; i < N; ++i)
                    sum += list[i]*(i+1);
                if(sum == S) ++ans;
            } while(next_permutation(list, list+N));
        } while(next_permutation(pats, pats+10));
        cout << ans << endl;
    }
    return 0;
}
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int N, S;
    while(cin >> N >> S) {
        int pats[10];
        for(int i = 0; i < 10; ++i) pats[i] = i<N ? 1 : 0;
        reverse(pats, pats+10);

        int ans = 0;
        do {
            int list[N], *pt = list;
            for(int i = 0; i < 10; ++i)
                if(pats[i]) *pt++ = i;

            do {
                int sum = 0;
                for(int i = 0; i < N; ++i)
                    sum += list[i]*(i+1);
                if(sum == S) ++ans;
            } while(next_permutation(list, list+N));
        } while(next_permutation(pats, pats+10));
        cout << ans << endl;
    }
    return 0;
}