"""simple docstring"""







from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt



def     lowercase__( __SCREAMING_SNAKE_CASE							:  int   ):
     lowercase_			:       int									=			int(number**0.5   )
     return number == sq * sq



def     lowercase__( __SCREAMING_SNAKE_CASE							:  int  ,    __SCREAMING_SNAKE_CASE							:  int  ,    __SCREAMING_SNAKE_CASE							:  int  ,    __SCREAMING_SNAKE_CASE							:  int  ,    __SCREAMING_SNAKE_CASE							:  int  ,    __SCREAMING_SNAKE_CASE							:  int   ):
     lowercase_			:       int									=			x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
     lowercase_			:       int									=			x_den * y_den * z_den
     lowercase_			:       int									=			gcd(__SCREAMING_SNAKE_CASE  ,    __SCREAMING_SNAKE_CASE   )
     top //= hcf
     bottom //= hcf
     return top, bottom



def     lowercase__( __SCREAMING_SNAKE_CASE							:  int = 35   ):
     lowercase_			:       set									=			set()
     lowercase_			:       int
     lowercase_			:       Fraction									=			Fraction(0   )
     lowercase_			:       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
                         lowercase_			:       str									=			x_num * y_den + x_den * y_num
                         lowercase_			:       Tuple									=			x_den * y_den
                         lowercase_			:       Dict									=			gcd(__SCREAMING_SNAKE_CASE  ,    __SCREAMING_SNAKE_CASE   )
                         z_num //= hcf
                         z_den //= hcf
                         if 0 < z_num < z_den <= order:
                              lowercase_			:       int									=			add_three(
                                  __SCREAMING_SNAKE_CASE  ,    __SCREAMING_SNAKE_CASE  ,    __SCREAMING_SNAKE_CASE  ,    __SCREAMING_SNAKE_CASE  ,    __SCREAMING_SNAKE_CASE  ,    __SCREAMING_SNAKE_CASE   )
                              unique_s.add(__SCREAMING_SNAKE_CASE   )

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

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

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

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

     return total.denominator + total.numerator


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


"""simple docstring"""







from math import sqrt



def     lowercase__( __SCREAMING_SNAKE_CASE							:  int   ):

     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(sqrt(__SCREAMING_SNAKE_CASE   ) + 1   )  ,    6   ):
          if number % i == 0 or number % (i + 2) == 0:
               return False
     return True



def     lowercase__( __SCREAMING_SNAKE_CASE							:  int = 1_00_01   ):
     lowercase_			:       str									=			0
     lowercase_			:       Optional[Any]									=			1
     while count != nth and number < 3:
          number += 1
          if is_prime(__SCREAMING_SNAKE_CASE   ):
               count += 1
     while count != nth:
          number += 2
          if is_prime(__SCREAMING_SNAKE_CASE   ):
               count += 1
     return number


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

