






from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt





def 				snake_case  (     lowerCamelCase					):




	'''simple docstring'''







	__lowercase             =  int(number**0.5					)
	return number == sq * sq





def 				snake_case  (     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 				snake_case  (     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 __future__ import annotations





def 				snake_case  (     lowerCamelCase					):




	'''simple docstring'''







	if not nums:
		return 0
	__lowercase             =  nums[0]
	__lowercase             =  0
	for num in nums[1:]:
		__lowercase       ,						__lowercase             =  (
		    max_excluding + num,
		    max(lowerCamelCase				,  lowerCamelCase					),
		)
	return max(lowerCamelCase				,  lowerCamelCase					)


if __name__ == "__main__":
						import doctest

						doctest.testmod()

