





'''simple docstring'''





from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt

def       A__(		__lowerCAmelCase ):
				_snake_case :			List[str]  						=   int(number**0.5 )
				return number == sq * sq

def       A__(		__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase ):
				_snake_case :			Union[str, Any]  						=   x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
				_snake_case :			str  						=   x_den * y_den * z_den
				_snake_case :			Optional[Any]  						=   gcd(__lowerCAmelCase	,			__lowerCAmelCase )
				top //= hcf
				bottom //= hcf
				return top, bottom

def       A__(		__lowerCAmelCase = 35 ):
				_snake_case :			Optional[Any]  						=   set()
				_snake_case :			int  						=   42
				_snake_case :			Optional[int]  						=   Fraction(0 )
				_snake_case :			Optional[Any]  						=   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
																				_snake_case :			str  						=   x_num * y_den + x_den * y_num
																				_snake_case :			Dict  						=   x_den * y_den
																				_snake_case :			Optional[Any]  						=   gcd(__lowerCAmelCase	,			__lowerCAmelCase )
																				z_num //= hcf
																				z_den //= hcf
																				if 0 < z_num < z_den <= order:
																								_snake_case :			str  						=   add_three(
																								    __lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase )
																								unique_s.add(__lowerCAmelCase )

																				# n=2
																				_snake_case :			Optional[int]  						=   (
																				    x_num * x_num * y_den * y_den + x_den * x_den * y_num * y_num
																				)
																				_snake_case :			Dict  						=   x_den * x_den * y_den * y_den
																				if is_sq(__lowerCAmelCase ) and is_sq(__lowerCAmelCase ):
																								_snake_case :			List[Any]  						=   int(sqrt(__lowerCAmelCase ) )
																								_snake_case :			Tuple  						=   int(sqrt(__lowerCAmelCase ) )
																								_snake_case :			Union[str, Any]  						=   gcd(__lowerCAmelCase	,			__lowerCAmelCase )
																								z_num //= hcf
																								z_den //= hcf
																								if 0 < z_num < z_den <= order:
																												_snake_case :			int  						=   add_three(
																												    __lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase )
																												unique_s.add(__lowerCAmelCase )

                    # n=-1
																				_snake_case :			List[Any]  						=   x_num * y_num
																				_snake_case :			Optional[int]  						=   x_den * y_num + x_num * y_den
																				_snake_case :			List[str]  						=   gcd(__lowerCAmelCase	,			__lowerCAmelCase )
																				z_num //= hcf
																				z_den //= hcf
																				if 0 < z_num < z_den <= order:
																								_snake_case :			List[Any]  						=   add_three(
																								    __lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase )
																								unique_s.add(__lowerCAmelCase )

																				# n=2
																				_snake_case :			List[Any]  						=   x_num * x_num * y_num * y_num
																				_snake_case :			Dict  						=   (
																				    x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
																				)
																				if is_sq(__lowerCAmelCase ) and is_sq(__lowerCAmelCase ):
																								_snake_case :			Optional[int]  						=   int(sqrt(__lowerCAmelCase ) )
																								_snake_case :			int  						=   int(sqrt(__lowerCAmelCase ) )
																								_snake_case :			List[str]  						=   gcd(__lowerCAmelCase	,			__lowerCAmelCase )
																								z_num //= hcf
																								z_den //= hcf
																								if 0 < z_num < z_den <= order:
																												_snake_case :			Dict  						=   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() = }''')













import itertools
import math

def       A__(		__lowerCAmelCase ):

				if 1 < number < 4:
								# 2 and 3 are primes
								return True
				elif number < 2 or number % 2 == 0 or number % 3 == 0:
								# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
								return False

				# All primes number are in format of 6k +/- 1
				for i in range(5	,			int(math.sqrt(__lowerCAmelCase ) + 1 )	,			6 ):
								if number % i == 0 or number % (i + 2) == 0:
												return False
				return True

def       A__(		):
				_snake_case :			Optional[Any]  						=   2
				while True:
								if is_prime(__lowerCAmelCase ):
												yield num
								num += 1

def       A__(		__lowerCAmelCase = 1_00_01 ):
				return next(itertools.islice(prime_generator()	,			nth - 1	,			__lowerCAmelCase ) )


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






