import functools
from functools import lru_cache
import sys
sys.setrecursionlimit(10**8)
class Solution:
# @param A : integer
# @param B : integer
# @return an integer
def solve(self, N, S):
if N == 0:
return 0
if S>9*N or S<0:
return 0
if N == 2:
return S
self.dp = {}
@functools.lru_cache(10**10)
def helper(N,S):
if (N,S) in self.dp :
return self.dp[(N,S)]
if S>9*N or S<0 :
return 0
if N == 1 :
if S<10 and S>=0:
return 1
else :
return 0
count = 0
for i in range(10):
count = count + helper(N-1,S-i)
self.dp[(N,S)] = count
return count
count = 0
for i in range(1,10):
count = count + helper(N-1,S-i)
return count%(1000000007)