
from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt



def 	UpperCamelCase   (							lowerCAmelCase__		):
					'''simple docstring'''
					lowercase						     =						int(number**0.5		)
					return number == sq * sq



def 	UpperCamelCase   (							lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__		):
					'''simple docstring'''
					lowercase						     =						x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
					lowercase						     =						x_den * y_den * z_den
					lowercase						     =						gcd(lowerCAmelCase__			,      lowerCAmelCase__		)
					top //= hcf
					bottom //= hcf
					return top, bottom



def 	UpperCamelCase   (							lowerCAmelCase__ = 35		):
					'''simple docstring'''
					lowercase						     =						set()
					lowercase						     =						42
					lowercase						     =						Fraction(0		)
					lowercase						     =						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
																									lowercase						     =						x_num * y_den + x_den * y_num
																									lowercase						     =						x_den * y_den
																									lowercase						     =						gcd(lowerCAmelCase__			,      lowerCAmelCase__		)
																									z_num //= hcf
																									z_den //= hcf
																									if 0 < z_num < z_den <= order:
																														lowercase						     =						add_three(
																														    lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__		)
																														unique_s.add(lowerCAmelCase__		)

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

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

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

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

					return total.denominator + total.numerator


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






from typing import TYPE_CHECKING

from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available
from ...utils import OptionalDependencyNotAvailable


lowercase__		:Union[str, Any]			  =   {"configuration_dpt": ["DPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DPTConfig"]}

try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowercase__		:List[Any]			  =   ["DPTFeatureExtractor"]
							lowercase__		:List[Any]			  =   ["DPTImageProcessor"]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowercase__		:Optional[int]			  =   [
							    "DPT_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "DPTForDepthEstimation",
							    "DPTForSemanticSegmentation",
							    "DPTModel",
							    "DPTPreTrainedModel",
							]


if TYPE_CHECKING:
							from .configuration_dpt import DPT_PRETRAINED_CONFIG_ARCHIVE_MAP, DPTConfig

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .feature_extraction_dpt import DPTFeatureExtractor
														from .image_processing_dpt import DPTImageProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_dpt import (
														    DPT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    DPTForDepthEstimation,
														    DPTForSemanticSegmentation,
														    DPTModel,
														    DPTPreTrainedModel,
														)


else:
							import sys

							lowercase__		:List[Any]			  =   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




