






__a :    int								=				{
    "0": 1,
    "1": 1,
    "2": 2,
    "3": 6,
    "4": 24,
    "5": 120,
    "6": 720,
    "7": 5040,
    "8": 40320,
    "9": 362880,
}

__a :    Union[str, Any]								=				{145: 145}

__a :    Any								=				{
    145: 0,
    169: 3,
    36301: 3,
    1454: 3,
    871: 2,
    45361: 2,
    872: 2,
}



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     int      )  -> int:





    """simple docstring"""

    if n in CACHE_SUM_DIGIT_FACTORIALS:
        return CACHE_SUM_DIGIT_FACTORIALS[n]
    __A             =		sum(DIGIT_FACTORIALS[let] for let in str(__lowercase      )      )
    __A             =		ret
    return ret



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     int     ,			__lowercase				:     set | None = None      )  -> int:





    """simple docstring"""

    __A             =		previous or set()
    if n in CHAIN_LENGTH_CACHE:
        return CHAIN_LENGTH_CACHE[n]
    __A             =		sum_digit_factorials(__lowercase      )
    if next_number in previous:
        __A             =		0
        return 0
    else:
        previous.add(__lowercase      )
        __A             =		1 + chain_length(__lowercase     ,			__lowercase      )
        __A             =		ret
        return ret



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     int = 6_0     ,			__lowercase				:     int = 1_0_0_0_0_0_0      )  -> int:





    """simple docstring"""

    return sum(1 for i in range(1     ,			__lowercase      ) if chain_length(__lowercase      ) == num_terms      )


if __name__ == "__main__":
  print(f"""{solution() = }""")












def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     int     ,			__lowercase				:     int      )  -> int:





    """simple docstring"""

    __A             =		1.0
    for i in range(1     ,			r + 1      ):
        ret *= (n + 1 - i) / i
    return round(__lowercase      )



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     int      )  -> int:





    """simple docstring"""

    return choose(8 + n     ,			__lowercase      ) + choose(9 + n     ,			__lowercase      ) - 1_0



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     int      )  -> int:





    """simple docstring"""

    return sum(non_bouncy_exact(__lowercase      ) for i in range(1     ,			n + 1      )      )



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     int = 1_0_0      )  -> int:





    """simple docstring"""

    return non_bouncy_upto(__lowercase      )


if __name__ == "__main__":
  print(f"""{solution() = }""")




