






"""simple docstring"""


_UpperCamelCase				:    Tuple     =						{
    '0': 1,
    '1': 1,
    '2': 2,
    '3': 6,
    '4': 24,
    '5': 120,
    '6': 720,
    '7': 5040,
    '8': 4_0320,
    '9': 36_2880,
}

_UpperCamelCase				:    Tuple     =						{145: 145}

_UpperCamelCase				:    str     =						{
    145: 0,
    169: 3,
    3_6301: 3,
    1454: 3,
    871: 2,
    4_5361: 2,
    872: 2,
}




def 			snake_case  (A_      :int      ):







  '''simple docstring'''

  if n in CACHE_SUM_DIGIT_FACTORIALS:
    return CACHE_SUM_DIGIT_FACTORIALS[n]
  a     :			List[Any]				=   sum(DIGIT_FACTORIALS[let] for let in str(A_      )      )
  a     :			Union[str, Any]				=   ret
  return ret




def 			snake_case  (A_      :int	,			A_      :set | None = None      ):







  '''simple docstring'''

  a     :			str				=   previous or set()
  if n in CHAIN_LENGTH_CACHE:
    return CHAIN_LENGTH_CACHE[n]
  a     :			List[str]				=   sum_digit_factorials(A_      )
  if next_number in previous:
    a     :			Dict				=   0
    return 0
  else:
    previous.add(A_      )
    a     :			Dict				=   1 + chain_length(A_	,			A_      )
    a     :			Optional[int]				=   ret
    return ret




def 			snake_case  (A_      :int = 6_0	,			A_      :int = 1_0_0_0_0_0_0      ):







  '''simple docstring'''

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


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












"""simple docstring"""


def 			snake_case  (A_      :int = 1_0_0_0      ):







  '''simple docstring'''

  a     :			Union[str, Any]				=   0
  a     :			int				=   (n - 1) // 3
  total += ((terms) * (6 + (terms - 1) * 3)) // 2  # total of an A.P.
  a     :			Tuple				=   (n - 1) // 5
  total += ((terms) * (1_0 + (terms - 1) * 5)) // 2
  a     :			Dict				=   (n - 1) // 1_5
  total -= ((terms) * (3_0 + (terms - 1) * 1_5)) // 2
  return total


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




