code: 
  
  
  
  
  
  __lowerCAmelCase     =			{
      "kilogram": 1,
      "gram": pow(10, 3),
      "milligram": pow(10, 6),
      "metric-ton": pow(10, -3),
      "long-ton": 0.0009842073,
      "short-ton": 0.0011023122,
      "pound": 2.2046244202,
      "stone": 0.1574731728,
      "ounce": 35.273990723,
      "carrat": 5_000,
      "atomic-mass-unit": 6.0_22_13_66_52e26,
  }
  
  __lowerCAmelCase     =			{
      "kilogram": 1,
      "gram": pow(10, -3),
      "milligram": pow(10, -6),
      "metric-ton": pow(10, 3),
      "long-ton": 1016.04608,
      "short-ton": 907.184,
      "pound": 0.453592,
      "stone": 6.35029,
      "ounce": 0.0283495,
      "carrat": 0.0002,
      "atomic-mass-unit": 1.6_60_54_01_99e-27,
  }
  
  def     a						(      _lowercase   :     str ,						_lowercase   :     str ,						_lowercase   :     float       )     ->float:
    if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
      UpperCamelCase__         =	(
          F"""Invalid 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"""
          F"""Supported values are: {', '.join(_lowercase       )}"""
      )
      raise ValueError(_lowercase       )
    return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]
  
  
  if __name__ == "__main__":
      import doctest
  
      doctest.testmod()
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  __lowerCAmelCase     =			{
      "0": 1,
      "1": 1,
      "2": 2,
      "3": 6,
      "4": 24,
      "5": 120,
      "6": 720,
      "7": 5_040,
      "8": 40_320,
      "9": 362_880,
  }
  
  __lowerCAmelCase     =			{145: 145}
  
  __lowerCAmelCase     =			{
      145: 0,
      169: 3,
      36_301: 3,
      1_454: 3,
      871: 2,
      45_361: 2,
      872: 2,
  }
  
  def     a						(      _lowercase   :     int       )     ->int:
  		if n in CACHE_SUM_DIGIT_FACTORIALS:
  				return CACHE_SUM_DIGIT_FACTORIALS[n]
  		UpperCamelCase__         =	sum(DIGIT_FACTORIALS[let] for let in str(_lowercase       )       )
  		UpperCamelCase__         =	ret
  		return ret
  
  def     a						(      _lowercase   :     int ,						_lowercase   :     set | None = None       )     ->int:
  		UpperCamelCase__         =	previous or set()
  		if n in CHAIN_LENGTH_CACHE:
  				return CHAIN_LENGTH_CACHE[n]
  		UpperCamelCase__         =	sum_digit_factorials(_lowercase       )
  		if next_number in previous:
  				UpperCamelCase__         =	0
  				return 0
  		else:
  				previous.add(_lowercase       )
  				UpperCamelCase__         =	1 + chain_length(_lowercase ,						_lowercase       )
  				UpperCamelCase__         =	ret
  				return ret
  
  def     a						(      _lowercase   :     int = 6_0 ,						_lowercase   :     int = 1_0_0_0_0_0_0       )     ->int:
  		return sum(1 for i in range(1 ,						_lowercase       ) if chain_length(_lowercase       ) == num_terms       )
  
  
  if __name__ == "__main__":
  				print(f"""{solution() = }""")
  
  
  
  
  
  