#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;

static const LL MODVAL = 1000000007;
int memo[10][11][1001][9];

class MegaCoolNumbers
{
public:
	int count(int N, int A)
	{
		memset(memo, -1, sizeof(memo));
		return rec(1, 10, N, A);
	}

	int rec(int D, int F, int N, int A)
	{
		if( A==0 )     return N==0 ? 1 : 0;
		if( N < A )    return 0;
		if( N==1 )     return 10-D - (F==10 ? 0 : 1);
		if( 10-D < A ) return 0;
		if( memo[D][F][N][A] != -1 )
			return memo[D][F][N][A];

		LL ans = 0;
		for(int d=D; d<=9; ++d) if(d!=F)
			for(int k=2; k<=N; ++k)
				for(int q=0; d+(k-1)*q<=9; ++q)
					ans += rec(d+(k-1)*q, min(10, d+k*q), N-k, A-1);
		return memo[D][F][N][A] = int(ans % MODVAL);
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time;string timer() { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }

template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
int verify_case(const int &Expected, const int &Received) { if (Expected == Received) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } return 0;}

template<int N> struct Case_ { Case_(){start_time=clock();} };
char Test_(...);
int Test_(Case_<0>) {
	int N = 1; 
	int A = 1; 
	int RetVal = 9; 
	return verify_case(RetVal, MegaCoolNumbers().count(N, A)); }
int Test_(Case_<1>) {
	int N = 2; 
	int A = 1; 
	int RetVal = 45; 
	return verify_case(RetVal, MegaCoolNumbers().count(N, A)); }
int Test_(Case_<2>) {
	int N = 2; 
	int A = 2; 
	int RetVal = 0; 
	return verify_case(RetVal, MegaCoolNumbers().count(N, A)); }
int Test_(Case_<3>) {
	int N = 10; 
	int A = 3; 
	int RetVal = 7502; 
	return verify_case(RetVal, MegaCoolNumbers().count(N, A)); }
int Test_(Case_<4>) {
	int N = 1000; 
	int A = 5; 
	int RetVal = 7502; 
	return verify_case(RetVal, MegaCoolNumbers().count(N, A)); }

template<int N> void Run_() { cerr << "Test Case #" << N << "..." << flush; Test_(Case_<N>()); Run_<sizeof(Test_(Case_<N+1>()))==1 ? -1 : N+1>(); }
template<>      void Run_<-1>() {}
int main() { Run_<0>(); }
// END CUT HERE

