


'''simple docstring'''



from json import JSONDecodeError  # Workaround for requests.exceptions.JSONDecodeError

import requests




def 			_a			(		_lowercase      :			str = "isbn/0140328726"						):





     '''simple docstring'''






     __UpperCAmelCase			:				Optional[Any]													=    olid.strip().strip('''/'''						)  # Remove leading/trailing whitespace & slashes
     if new_olid.count('''/'''						) != 1:
          __UpperCAmelCase			:				Tuple													=    F'{olid} is not a valid Open Library olid'
          raise ValueError(UpperCAmelCase__						)
     return requests.get(F'https://openlibrary.org/{new_olid}.json'						).json()




def 			_a			(		_lowercase      :			dict						):





     '''simple docstring'''






     __UpperCAmelCase			:				str													=    {
         '''title''': '''Title''',
         '''publish_date''': '''Publish date''',
         '''authors''': '''Authors''',
         '''number_of_pages''': '''Number of pages:''',
         '''first_sentence''': '''First sentence''',
         '''isbn_10''': '''ISBN (10)''',
         '''isbn_13''': '''ISBN (13)''',
     }
     __UpperCAmelCase			:				List[str]													=    {better_key: ol_book_data[key] for key, better_key in desired_keys.items()}
     __UpperCAmelCase			:				Any													=    [
         get_openlibrary_data(author['''key''']						)['''name'''] for author in data['''Authors''']
     ]
     __UpperCAmelCase			:				int													=    data['''First sentence''']['''value''']
     for key, value in data.items():
          if isinstance(UpperCAmelCase__    ,      UpperCAmelCase__						):
               __UpperCAmelCase			:				Tuple													=    ''', '''.join(UpperCAmelCase__						)
     return data


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  while True:
    __UpperCAmelCase    :str				       =     input("\nEnter the ISBN code to search (or \'quit\' to stop): ").strip()
    if isbn.lower() in ("", "q", "quit", "exit", "stop"):
      break

    if len(isbn) not in (1_0, 1_3) or not isbn.isdigit():
      print(f"""Sorry, {isbn} is not a valid ISBN.  Please, input a valid ISBN.""")
      continue

    print(f"""\nSearching Open Library for ISBN: {isbn}...\n""")

    try:
      __UpperCAmelCase    :str				       =     summarize_book(get_openlibrary_data(f"""isbn/{isbn}"""))
      print("\n".join(f"""{key}: {value}""" for key, value in book_summary.items()))
    except JSONDecodeError:  # Workaround for requests.exceptions.RequestException:
      print(f"""Sorry, there are no results for ISBN: {isbn}.""")



'''simple docstring'''



from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt




def 			_a			(		_lowercase      :			int						):





     '''simple docstring'''






     __UpperCAmelCase			:				int													=    int(number**0.5						)
     return number == sq * sq




def 			_a			(		_lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			int    ,      _lowercase      :			int						):





     '''simple docstring'''






     __UpperCAmelCase			:				int													=    x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
     __UpperCAmelCase			:				int													=    x_den * y_den * z_den
     __UpperCAmelCase			:				int													=    gcd(_lowercase    ,      _lowercase						)
     top //= hcf
     bottom //= hcf
     return top, bottom




def 			_a			(		_lowercase      :			int = 35						):





     '''simple docstring'''






     __UpperCAmelCase			:				set													=    set()
     __UpperCAmelCase			:				int
     __UpperCAmelCase			:				Fraction													=    Fraction(0						)
     __UpperCAmelCase			:				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
                         __UpperCAmelCase			:				Optional[int]													=    x_num * y_den + x_den * y_num
                         __UpperCAmelCase			:				Dict													=    x_den * y_den
                         __UpperCAmelCase			:				List[Any]													=    gcd(_lowercase    ,      _lowercase						)
                         z_num //= hcf
                         z_den //= hcf
                         if 0 < z_num < z_den <= order:
                              __UpperCAmelCase			:				Dict													=    add_three(
                                  _lowercase    ,      _lowercase    ,      _lowercase    ,      _lowercase    ,      _lowercase    ,      _lowercase						)
                              unique_s.add(_lowercase						)

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

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

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

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

     return total.denominator + total.numerator


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