






from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt






def 					lowerCamelCase__					(_UpperCAmelCase):
			SCREAMING_SNAKE_CASE							=			int(number**0.5)
			return number == sq * sq






def 					lowerCamelCase__					(_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase):
			SCREAMING_SNAKE_CASE							=			x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
			SCREAMING_SNAKE_CASE							=			x_den * y_den * z_den
			SCREAMING_SNAKE_CASE							=			gcd(_UpperCAmelCase				,							_UpperCAmelCase)
			top //= hcf
			bottom //= hcf
			return top, bottom






def 					lowerCamelCase__					(_UpperCAmelCase = 35):
			SCREAMING_SNAKE_CASE							=			set()
			SCREAMING_SNAKE_CASE							=			42
			SCREAMING_SNAKE_CASE							=			Fraction(0)
			SCREAMING_SNAKE_CASE							=			42

			for x_num in range(1				,							order + 1):
						for x_den in range(x_num + 1				,							order + 1):
									for y_num in range(1				,							order + 1):
												for y_den in range(y_num + 1				,							order + 1):
															# n=1
															SCREAMING_SNAKE_CASE							=			x_num * y_den + x_den * y_num
															SCREAMING_SNAKE_CASE							=			x_den * y_den
															SCREAMING_SNAKE_CASE							=			gcd(_UpperCAmelCase				,							_UpperCAmelCase)
															z_num //= hcf
															z_den //= hcf
															if 0 < z_num < z_den <= order:
																		SCREAMING_SNAKE_CASE							=			add_three(
																		    _UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase)
																		unique_s.add(_UpperCAmelCase)

															# n=2
															SCREAMING_SNAKE_CASE							=			(
															    x_num * x_num * y_den * y_den + x_den * x_den * y_num * y_num
															)
															SCREAMING_SNAKE_CASE							=			x_den * x_den * y_den * y_den
															if is_sq(_UpperCAmelCase) and is_sq(_UpperCAmelCase):
																		SCREAMING_SNAKE_CASE							=			int(sqrt(_UpperCAmelCase))
																		SCREAMING_SNAKE_CASE							=			int(sqrt(_UpperCAmelCase))
																		SCREAMING_SNAKE_CASE							=			gcd(_UpperCAmelCase				,							_UpperCAmelCase)
																		z_num //= hcf
																		z_den //= hcf
																		if 0 < z_num < z_den <= order:
																					SCREAMING_SNAKE_CASE							=			add_three(
																					    _UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase)
																					unique_s.add(_UpperCAmelCase)

                    # n=-1
															SCREAMING_SNAKE_CASE							=			x_num * y_num
															SCREAMING_SNAKE_CASE							=			x_den * y_num + x_num * y_den
															SCREAMING_SNAKE_CASE							=			gcd(_UpperCAmelCase				,							_UpperCAmelCase)
															z_num //= hcf
															z_den //= hcf
															if 0 < z_num < z_den <= order:
																		SCREAMING_SNAKE_CASE							=			add_three(
																		    _UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase)
																		unique_s.add(_UpperCAmelCase)

															# n=2
															SCREAMING_SNAKE_CASE							=			x_num * x_num * y_num * y_num
															SCREAMING_SNAKE_CASE							=			(
															    x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
															)
															if is_sq(_UpperCAmelCase) and is_sq(_UpperCAmelCase):
																		SCREAMING_SNAKE_CASE							=			int(sqrt(_UpperCAmelCase))
																		SCREAMING_SNAKE_CASE							=			int(sqrt(_UpperCAmelCase))
																		SCREAMING_SNAKE_CASE							=			gcd(_UpperCAmelCase				,							_UpperCAmelCase)
																		z_num //= hcf
																		z_den //= hcf
																		if 0 < z_num < z_den <= order:
																					SCREAMING_SNAKE_CASE							=			add_three(
																					    _UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase)
																					unique_s.add(_UpperCAmelCase)

			for num, den in unique_s:
						total += Fraction(_UpperCAmelCase				,							_UpperCAmelCase)

			return total.denominator + total.numerator


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











"""simple docstring"""



from collections import namedtuple

a_					=     namedtuple("""from_to""", """from_ to""")

a_					=     {
    """cubicmeter""": from_to(1, 1),
    """litre""": from_to(0.001, 1000),
    """kilolitre""": from_to(1, 1),
    """gallon""": from_to(0.00454, 264.172),
    """cubicyard""": from_to(0.76455, 1.30795),
    """cubicfoot""": from_to(0.028, 35.3147),
    """cup""": from_to(0.000236588, 4226.75),
}







def 						__lowercase	(  snake_case_    :    float							,snake_case_    :    str							,snake_case_    :    str		)  ->float:



    '''simple docstring'''







    if from_type not in METRIC_CONVERSION:
        raise ValueError(
            F"""Invalid 'from_type' value: {from_type!r}  Supported values are:\n"""
            + ''', '''.join(snake_case_		)		)
    if to_type not in METRIC_CONVERSION:
        raise ValueError(
            F"""Invalid 'to_type' value: {to_type!r}.  Supported values are:\n"""
            + ''', '''.join(snake_case_		)		)
    return value * METRIC_CONVERSION[from_type].from_ * METRIC_CONVERSION[to_type].to


if __name__ == "__main__":
       import doctest

       doctest.testmod()




