#include <stdio.h>
int cnt;void dfs(int left, int mask, int sum) {
    if (sum<0) return; else if (!sum) {if (!left || (left==1 && !(mask&1))) cnt++;return;}
    for (int i=0;i<10;i++) if (!(mask&(1<<i))) {if (sum-left*i<0) return; else dfs(left-1,mask|(1<<i),sum-left*i);}
}
int main() {int i,N,s;while (scanf("%d %d",&N,&s)!=EOF) {cnt=0;for (i=0;i<10;i++) dfs(N-1,1<<i,s-N*i);printf("%d\n",cnt);} return 0;}