#include <iostream>
#include <cstring>

int left[11][11][1010];
int func(int n, int used, int m){
    if(n == 0)
        return m == 0;
    
    if(left[n][used][m] != -1)
        return left[n][used][m];
    
    int sum = 0;
    for(int i = 0; i < 10; ++i){
        if(m - i >= 0 && !(used & 1 << i)){
            sum += func(n - 1, used | 1 << i, m - i);
        }
    }
    
    return sum;
}

int main(){
    memset(left, -1, sizeof(left));
    
    int n, m;
    while(std::cin >> n >> m, n * m){
        std::cout << func(n, 0, m) / 6 << std::endl;
    }
}