



'''simple docstring'''






from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt
def  lowerCamelCase__			(		_A							):
  a		:   Optional[Any]	  =	int(number**0.5							)
  return number == sq * sq
def  lowerCamelCase__			(		_A					,     _A					,     _A					,     _A					,     _A					,     _A							):
  a		:   List[str]	  =	x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
  a		:   Optional[int]	  =	x_den * y_den * z_den
  a		:   Any	  =	gcd(UpperCamelCase_					,     UpperCamelCase_							)
  top //= hcf
  bottom //= hcf
  return top, bottom
def  lowerCamelCase__			(		_A = 35							):
  a		:   List[str]	  =	set()
  a		:   str	  =	42
  a		:   Any	  =	Fraction(0							)
  a		:   List[str]	  =	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
          a		:   int	  =	x_num * y_den + x_den * y_num
          a		:   Union[str, Any]	  =	x_den * y_den
          a		:   Optional[int]	  =	gcd(UpperCamelCase_					,     UpperCamelCase_							)
          z_num //= hcf
          z_den //= hcf
          if 0 < z_num < z_den <= order:
            a		:   List[str]	  =	add_three(
                UpperCamelCase_					,     UpperCamelCase_					,     UpperCamelCase_					,     UpperCamelCase_					,     UpperCamelCase_					,     UpperCamelCase_							)
            unique_s.add(UpperCamelCase_							)

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

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

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



class     A__   :







    """simple docstring"""

    def __init__(			self     ,   __snake_case       ):
         snake_case											=							n
         snake_case											=							[None] * self.n
         snake_case											=							0  # index of the first element
         snake_case											=							0
         snake_case											=							0
    def __len__(			self       ):
         return self.size
    def 						a_     (			self       ):
         return self.size == 0
    def 						a_     (			self       ):
         return False if self.is_empty() else self.array[self.front]
    def 						a_     (			self     ,   __snake_case       ):
         if self.size >= self.n:
              raise Exception('''QUEUE IS FULL'''       )

         snake_case											=							data
         snake_case											=							(self.rear + 1) % self.n
         self.size += 1
         return self




    def 						a_     (			self       ):
         if self.size == 0:
              raise Exception('''UNDERFLOW'''       )

         snake_case											=							self.array[self.front]
         snake_case											=							None
         snake_case											=							(self.front + 1) % self.n
         self.size -= 1
         return temp




