



'''simple docstring'''


from __future__ import annotations

from fractions import Fraction
from math import gcd, sqrt







def 				__lowerCamelCase				(   A__    )       ->	bool:






   """simple docstring"""
   UpperCamelCase					=  int(number**0.5    )
   return number == sq * sq







def 				__lowerCamelCase				(   A__    ,						A__    ,						A__    ,						A__    ,						A__    ,						A__    )       ->	tuple[int, int]:






   """simple docstring"""
   UpperCamelCase					=  x_num * y_den * z_den + y_num * x_den * z_den + z_num * x_den * y_den
   UpperCamelCase					=  x_den * y_den * z_den
   UpperCamelCase					=  gcd(A__    ,						A__    )
   top //= hcf
   bottom //= hcf
   return top, bottom







def 				__lowerCamelCase				(   A__ = 35    )       ->	int:






   """simple docstring"""
   UpperCamelCase					=  set()
   UpperCamelCase					=  42
   UpperCamelCase					=  Fraction(0    )
   UpperCamelCase					=  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
               UpperCamelCase					=  x_num * y_den + x_den * y_num
               UpperCamelCase					=  x_den * y_den
               UpperCamelCase					=  gcd(A__    ,						A__    )
               z_num //= hcf
               z_den //= hcf
               if 0 < z_num < z_den <= order:
                  UpperCamelCase					=  add_three(
                      A__    ,						A__    ,						A__    ,						A__    ,						A__    ,						A__    )
                  unique_s.add(A__    )

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

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

               # n=2
               UpperCamelCase					=  x_num * x_num * y_num * y_num
               UpperCamelCase					=  (
                   x_den * x_den * y_num * y_num + x_num * x_num * y_den * y_den
               )
               if is_sq(A__    ) and is_sq(A__    ):
                  UpperCamelCase					=  int(sqrt(A__    )    )
                  UpperCamelCase					=  int(sqrt(A__    )    )
                  UpperCamelCase					=  gcd(A__    ,						A__    )
                  z_num //= hcf
                  z_den //= hcf
                  if 0 < z_num < z_den <= order:
                     UpperCamelCase					=  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"""







import warnings

from ...utils import is_sklearn_available, requires_backends


if is_sklearn_available():
		from scipy.stats import pearsonr, spearmanr
		from sklearn.metrics import fa_score, matthews_corrcoef


a__				:							Any						=     (
    '''This metric will be removed from the library soon, metrics should be handled with the 🤗 Evaluate '''
    '''library. You can have a look at this example script for pointers: '''
    '''https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-classification/run_glue.py'''
)




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					return (preds == labels).mean()




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					__SCREAMING_SNAKE_CASE						   =				simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )
					__SCREAMING_SNAKE_CASE						   =				fa_score(y_true=lowerCAmelCase_  ,						y_pred=lowerCAmelCase_   )
					return {
					    "acc": acc,
					    "f1": fa,
					    "acc_and_f1": (acc + fa) / 2,
					}




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					__SCREAMING_SNAKE_CASE						   =				pearsonr(lowerCAmelCase_  ,						lowerCAmelCase_   )[0]
					__SCREAMING_SNAKE_CASE						   =				spearmanr(lowerCAmelCase_  ,						lowerCAmelCase_   )[0]
					return {
					    "pearson": pearson_corr,
					    "spearmanr": spearman_corr,
					    "corr": (pearson_corr + spearman_corr) / 2,
					}




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					assert len(lowerCAmelCase_   ) == len(lowerCAmelCase_   ), f"""Predictions and labels have mismatched lengths {len(lowerCAmelCase_   )} and {len(lowerCAmelCase_   )}"""
					if task_name == "cola":
										return {"mcc": matthews_corrcoef(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "sst-2":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "mrpc":
										return acc_and_fa(lowerCAmelCase_  ,						lowerCAmelCase_   )
					elif task_name == "sts-b":
										return pearson_and_spearman(lowerCAmelCase_  ,						lowerCAmelCase_   )
					elif task_name == "qqp":
										return acc_and_fa(lowerCAmelCase_  ,						lowerCAmelCase_   )
					elif task_name == "mnli":
										return {"mnli/acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "mnli-mm":
										return {"mnli-mm/acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "qnli":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "rte":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "wnli":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					elif task_name == "hans":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					else:
										raise KeyError(lowerCAmelCase_   )




def    UpperCAmelCase__       (lowerCAmelCase_  ,						lowerCAmelCase_  ,						lowerCAmelCase_   ):




					'''simple docstring'''


					warnings.warn(lowerCAmelCase_  ,						lowerCAmelCase_   )
					requires_backends(lowerCAmelCase_  ,						"sklearn"   )
					if len(lowerCAmelCase_   ) != len(lowerCAmelCase_   ):
										raise ValueError(f"""Predictions and labels have mismatched lengths {len(lowerCAmelCase_   )} and {len(lowerCAmelCase_   )}"""   )
					if task_name == "xnli":
										return {"acc": simple_accuracy(lowerCAmelCase_  ,						lowerCAmelCase_   )}
					else:
										raise KeyError(lowerCAmelCase_   )
