




"""simple docstring"""
from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt





def 						UpperCAmelCase				(			A__:    int     )  ->     bool:
			__lowerCamelCase					:	int	       =				int(number**0.5     )
			return number == sq * sq





def 						UpperCAmelCase				(			A__:    int							,				A__:    int							,				A__:    int							,				A__:    int							,				A__:    int							,				A__:    int     )  ->     tuple[int, int]:
			__lowerCamelCase					:	int	       =				x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
			__lowerCamelCase					:	int	       =				x_den * y_den * z_den
			__lowerCamelCase					:	int	       =				gcd(A__							,				A__     )
			top //= hcf
			bottom //= hcf
			return top, bottom





def 						UpperCAmelCase				(			A__:    int = 35     )  ->     int:
			__lowerCamelCase					:	set	       =				set()
			__lowerCamelCase					:	int
			__lowerCamelCase					:	Fraction	       =				Fraction(0     )
			__lowerCamelCase					:	tuple[int, int]

			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
															__lowerCamelCase					:	str	       =				x_num * y_den + x_den * y_num
															__lowerCamelCase					:	str	       =				x_den * y_den
															__lowerCamelCase					:	int	       =				gcd(A__							,				A__     )
															z_num //= hcf
															z_den //= hcf
															if 0 < z_num < z_den <= order:
																		__lowerCamelCase					:	Optional[int]	       =				add_three(
																		    A__							,				A__							,				A__							,				A__							,				A__							,				A__     )
																		unique_s.add(A__     )

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

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

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

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

			return total.denominator + total.numerator


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









"""simple docstring"""
from cva import destroyAllWindows, imread, imshow, waitKey





def 						UpperCAmelCase				(			A__:    Tuple     )  ->     Union[str, Any]:
			# getting number of pixels in the image
			__lowerCamelCase       ,      __lowerCamelCase					:	Optional[Any]	       =				img.shape[0], img.shape[1]

			# converting each pixel's color to its negative
			for i in range(A__     ):
						for j in range(A__     ):
									__lowerCamelCase					:	Optional[Any]	       =				[255, 255, 255] - img[i][j]

			return img


if __name__ == "__main__":
					# read original image
					a_				:    Dict										=     imread('''image_data/lena.jpg''', 1)

					# convert to its negative
					a_				:    str										=     convert_to_negative(img)

					# show result image
					imshow('''negative of original image''', img)
					waitKey(0)
					destroyAllWindows()



