


_A			=						{
    'meter': 'm',
    'kilometer': 'km',
    'megametre': 'Mm',
    'gigametre': 'Gm',
    'terametre': 'Tm',
    'petametre': 'Pm',
    'exametre': 'Em',
    'zettametre': 'Zm',
    'yottametre': 'Ym',
}
# Exponent of the factor(meter)
_A			=						{
    'm': 0,
    'km': 3,
    'Mm': 6,
    'Gm': 9,
    'Tm': 12,
    'Pm': 15,
    'Em': 18,
    'Zm': 21,
    'Ym': 24,
}

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : Union[str, Any]      ,					SCREAMING_SNAKE_CASE__      : Optional[Any]      ,					SCREAMING_SNAKE_CASE__      : Any    ):
					__UpperCamelCase   							=from_type.lower().strip('s'    )
					__UpperCamelCase   							=to_type.lower().strip('s'    )

					__UpperCamelCase   							=UNIT_SYMBOL.get(_A      ,					_A    )
					__UpperCamelCase   							=UNIT_SYMBOL.get(_A      ,					_A    )

					if from_sanitized not in METRIC_CONVERSION:
										__UpperCamelCase   							=(
										    F'Invalid \'from_type\' value: {from_type!r}.\n'
										    F'Conversion abbreviations are: {", ".join(_A    )}'
										)
										raise ValueError(_A    )
					if to_sanitized not in METRIC_CONVERSION:
										__UpperCamelCase   							=(
										    F'Invalid \'to_type\' value: {to_type!r}.\n'
										    F'Conversion abbreviations are: {", ".join(_A    )}'
										)
										raise ValueError(_A    )
					__UpperCamelCase   							=METRIC_CONVERSION[from_sanitized]
					__UpperCamelCase   							=METRIC_CONVERSION[to_sanitized]
					__UpperCamelCase   							=1

					if from_exponent > to_exponent:
										__UpperCamelCase   							=from_exponent - to_exponent
					else:
										__UpperCamelCase   							=-(to_exponent - from_exponent)

					return value * pow(10      ,					_A    )


if __name__ == "__main__":
			from doctest import testmod

			testmod()









from __future__ import annotations

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     if b == 0:
          return (1, 0)
     ((__UpperCamelCase)							,				(__UpperCamelCase))   							=extended_euclid(SCREAMING_SNAKE_CASE__      ,					a % b    )
     __UpperCamelCase   							=a // b
     return (y, x - k * y)

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     ((__UpperCamelCase)							,				(__UpperCamelCase))   							=extended_euclid(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )
     __UpperCamelCase   							=na * na
     __UpperCamelCase   							=ra * x * na + ra * y * na
     return (n % m + m) % m

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     ((__UpperCamelCase)							,				(__UpperCamelCase))   							=extended_euclid(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )
     if b < 0:
          __UpperCamelCase   							=(b % n + n) % n
     return b

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int      ,					SCREAMING_SNAKE_CASE__      : int    ):
     __UpperCamelCase							,				__UpperCamelCase   							=invert_modulo(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    ), invert_modulo(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )
     __UpperCamelCase   							=na * na
     __UpperCamelCase   							=ra * x * na + ra * y * na
     return (n % m + m) % m


if __name__ == "__main__":
   from doctest import testmod

   testmod(name='chinese_remainder_theorem', verbose=True)
   testmod(name='chinese_remainder_theorem2', verbose=True)
   testmod(name='invert_modulo', verbose=True)
   testmod(name='extended_euclid', verbose=True)





