#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<functional>
#include <memory.h>



using namespace std;



int main(){
    int n,s;
    int num[10]={0,1,2,3,4,5,6,7,8,9};
    while(cin>>n>>s){
        int count=0;
        do{
            int ans=0;
            for(int i=0; i<n; i++){
                ans += (1+i)*num[i];
            }
            if(ans==s)count++;
        }while(next_permutation(num, num+10));
        int x=1;
        for(int i=1; i<=10-n; i++){
            x*=i;
        }
        cout<<count/x<<endl;
    }
    

}
    
    