#include <iostream>

using namespace std;

int main()
{
  int const xs[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  
  int n, s;
  while( cin >> n >> s ) {
    int num = 0;
    for( int i=0; i<1024; ++i ) {
      int nx = 1, sum = 0;
      for( int j=0; j<8; ++j ) {
        if ( i & 1 << j ) {
          sum += nx * xs[j];
          ++nx;
        }
      }
      if ( nx == n && sum == s ) {
        ++num;
      }
    }
    cout << num << endl;
  }
}