@classmethod
@lru_cache(maxsize=None)
def choose(cls, n, r, mod=None):
    if ((r > n) or (r < 0)):
        return 0
    if (r == 0):
        return 1
    res = (cls.choose((n - 1), r, mod) + cls.choose((n - 1), (r - 1), mod))
    if mod:
        res %= mod
    return res
@classmethod
@lru_cache(maxsize=None)
def choose(cls, n, r, mod=None):
    if ((r > n) or (r < 0)):
        return 0
    if (r == 0):
        return 1
    res = (cls.choose((n - 1), r, mod) + cls.choose((n - 1), (r - 1), mod))
    if mod:
        res %= mod
    return res