





import numpy as np

class 		UpperCamelCase__ :



     '''simple docstring'''

     def __init__(							self						:    str						,lowerCamelCase__						:    Optional[Any]=None						,lowerCamelCase__						:    Union[str, Any]=None						,lowerCamelCase__						:    Dict=None						,lowerCamelCase__						:    Dict=None						,lowerCamelCase__						:    Dict=None       )     ->		int:




           '''simple docstring'''


           self.set_matricies(red=lowercase_						,green=lowercase_						,blue=lowercase_						,red_edge=lowercase_						,nir=lowercase_       )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]						,lowerCamelCase__						:    int=None						,lowerCamelCase__						:    Tuple=None						,lowerCamelCase__						:    List[str]=None						,lowerCamelCase__						:    Optional[int]=None						,lowerCamelCase__						:    Any=None       )     ->		Tuple:




           '''simple docstring'''


           if red is not None:
                 SCREAMING_SNAKE_CASE		=						red
           if green is not None:
                 SCREAMING_SNAKE_CASE		=						green
           if blue is not None:
                 SCREAMING_SNAKE_CASE		=						blue
           if red_edge is not None:
                 SCREAMING_SNAKE_CASE		=						red_edge
           if nir is not None:
                 SCREAMING_SNAKE_CASE		=						nir
           return True






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict						,lowerCamelCase__						:    Union[str, Any]=""						,lowerCamelCase__						:    Any=None						,lowerCamelCase__						:    List[str]=None						,lowerCamelCase__						:    List[Any]=None						,lowerCamelCase__						:    Any=None						,lowerCamelCase__						:    Dict=None       )     ->		List[str]:




           '''simple docstring'''


           self.set_matricies(red=lowercase_						,green=lowercase_						,blue=lowercase_						,red_edge=lowercase_						,nir=lowercase_       )
           SCREAMING_SNAKE_CASE		=						{
               "ARVI2": self.arvaa,
               "CCCI": self.ccci,
               "CVI": self.cvi,
               "GLI": self.gli,
               "NDVI": self.ndvi,
               "BNDVI": self.bndvi,
               "redEdgeNDVI": self.red_edge_ndvi,
               "GNDVI": self.gndvi,
               "GBNDVI": self.gbndvi,
               "GRNDVI": self.grndvi,
               "RBNDVI": self.rbndvi,
               "PNDVI": self.pndvi,
               "ATSAVI": self.atsavi,
               "BWDRVI": self.bwdrvi,
               "CIgreen": self.ci_green,
               "CIrededge": self.ci_rededge,
               "CI": self.ci,
               "CTVI": self.ctvi,
               "GDVI": self.gdvi,
               "EVI": self.evi,
               "GEMI": self.gemi,
               "GOSAVI": self.gosavi,
               "GSAVI": self.gsavi,
               "Hue": self.hue,
               "IVI": self.ivi,
               "IPVI": self.ipvi,
               "I": self.i,
               "RVI": self.rvi,
               "MRVI": self.mrvi,
               "MSAVI": self.m_savi,
               "NormG": self.norm_g,
               "NormNIR": self.norm_nir,
               "NormR": self.norm_r,
               "NGRDI": self.ngrdi,
               "RI": self.ri,
               "S": self.s,
               "IF": self._if,
               "DVI": self.dvi,
               "TVI": self.tvi,
               "NDRE": self.ndre,
           }

           try:
                 return funcs[index]()
           except KeyError:
                 print("""Index not in the list!"""       )
                 return False






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]       )     ->		str:




           '''simple docstring'''


           return -0.18 + (1.17 * ((self.nir - self.red) / (self.nir + self.red)))






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict       )     ->		List[str]:




           '''simple docstring'''


           return ((self.nir - self.redEdge) / (self.nir + self.redEdge)) / (
               (self.nir - self.red) / (self.nir + self.red)
           )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[Any]       )     ->		List[Any]:




           '''simple docstring'''


           return self.nir * (self.red / (self.green**2))






     def 				SCREAMING_SNAKE_CASE__  (							self						:    str       )     ->		Dict:




           '''simple docstring'''


           return (2 * self.green - self.red - self.blue) / (
               2 * self.green + self.red + self.blue
           )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Tuple       )     ->		List[str]:




           '''simple docstring'''


           return (self.nir - self.red) / (self.nir + self.red)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]       )     ->		List[Any]:




           '''simple docstring'''


           return (self.nir - self.blue) / (self.nir + self.blue)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    int       )     ->		str:




           '''simple docstring'''


           return (self.redEdge - self.red) / (self.redEdge + self.red)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[str]       )     ->		str:




           '''simple docstring'''


           return (self.nir - self.green) / (self.nir + self.green)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		Tuple:




           '''simple docstring'''


           return (self.nir - (self.green + self.blue)) / (
               self.nir + (self.green + self.blue)
           )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[str]       )     ->		List[Any]:




           '''simple docstring'''


           return (self.nir - (self.green + self.red)) / (
               self.nir + (self.green + self.red)
           )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    int       )     ->		List[str]:




           '''simple docstring'''


           return (self.nir - (self.blue + self.red)) / (self.nir + (self.blue + self.red))






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Any       )     ->		Optional[Any]:




           '''simple docstring'''


           return (self.nir - (self.green + self.red + self.blue)) / (
               self.nir + (self.green + self.red + self.blue)
           )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Any						,lowerCamelCase__						:    List[Any]=0.08						,lowerCamelCase__						:    List[str]=1.22						,lowerCamelCase__						:    Union[str, Any]=0.03       )     ->		Optional[int]:




           '''simple docstring'''


           return a * (
               (self.nir - a * self.red - b)
               / (a * self.nir + self.red - a * b + x * (1 + a**2))
           )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[str]       )     ->		List[str]:




           '''simple docstring'''


           return (0.1 * self.nir - self.blue) / (0.1 * self.nir + self.blue)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[int]       )     ->		Union[str, Any]:




           '''simple docstring'''


           return (self.nir / self.green) - 1






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[Any]       )     ->		int:




           '''simple docstring'''


           return (self.nir / self.redEdge) - 1






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[Any]       )     ->		List[Any]:




           '''simple docstring'''


           return (self.red - self.blue) / self.red






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]       )     ->		int:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.ndvi()
           return ((ndvi + 0.5) / (abs(ndvi + 0.5       ))) * (abs(ndvi + 0.5       ) ** (1 / 2))






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Tuple       )     ->		List[Any]:




           '''simple docstring'''


           return self.nir - self.green






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]       )     ->		Optional[Any]:




           '''simple docstring'''


           return 2.5 * (
               (self.nir - self.red) / (self.nir + 6 * self.red - 7.5 * self.blue + 1)
           )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]       )     ->		Optional[Any]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						(2 * (self.nir**2 - self.red**2) + 1.5 * self.nir + 0.5 * self.red) / (
               self.nir + self.red + 0.5
           )
           return n * (1 - 0.25 * n) - (self.red - 0.125) / (1 - self.red)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict						,lowerCamelCase__						:    Optional[Any]=0.16       )     ->		Optional[int]:




           '''simple docstring'''


           return (self.nir - self.green) / (self.nir + self.green + y)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict						,lowerCamelCase__						:    Union[str, Any]=0.5       )     ->		Dict:




           '''simple docstring'''


           return ((self.nir - self.green) / (self.nir + self.green + n)) * (1 + n)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[str]       )     ->		str:




           '''simple docstring'''


           return np.arctan(
               ((2 * self.red - self.green - self.blue) / 30.5) * (self.green - self.blue)       )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[Any]						,lowerCamelCase__						:    int=None						,lowerCamelCase__						:    Union[str, Any]=None       )     ->		List[str]:




           '''simple docstring'''


           return (self.nir - b) / (a * self.red)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[str]       )     ->		List[str]:




           '''simple docstring'''


           return (self.nir / ((self.nir + self.red) / 2)) * (self.ndvi() + 1)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict       )     ->		Any:




           '''simple docstring'''


           return (self.red + self.green + self.blue) / 30.5






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Tuple       )     ->		Optional[int]:




           '''simple docstring'''


           return self.nir / self.red






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[int]       )     ->		Any:




           '''simple docstring'''


           return (self.rvi() - 1) / (self.rvi() + 1)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[int]       )     ->		str:




           '''simple docstring'''


           return (
               (2 * self.nir + 1)
               - ((2 * self.nir + 1) ** 2 - 8 * (self.nir - self.red)) ** (1 / 2)
           ) / 2






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Any       )     ->		Tuple:




           '''simple docstring'''


           return self.green / (self.nir + self.red + self.green)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    str       )     ->		Optional[Any]:




           '''simple docstring'''


           return self.nir / (self.nir + self.red + self.green)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict       )     ->		Any:




           '''simple docstring'''


           return self.red / (self.nir + self.red + self.green)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]       )     ->		Any:




           '''simple docstring'''


           return (self.green - self.red) / (self.green + self.red)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    int       )     ->		Optional[int]:




           '''simple docstring'''


           return (self.red - self.green) / (self.red + self.green)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[str]       )     ->		int:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						np.max([np.max(self.red       ), np.max(self.green       ), np.max(self.blue       )]       )
           SCREAMING_SNAKE_CASE		=						np.min([np.min(self.red       ), np.min(self.green       ), np.min(self.blue       )]       )
           return (max_value - min_value) / max_value






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		Tuple:




           '''simple docstring'''


           return (2 * self.red - self.green - self.blue) / (self.green - self.blue)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		List[str]:




           '''simple docstring'''


           return self.nir / self.red






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[int]       )     ->		List[str]:




           '''simple docstring'''


           return (self.ndvi() + 0.5) ** (1 / 2)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    int       )     ->		Optional[int]:




           '''simple docstring'''


           return (self.nir - self.redEdge) / (self.nir + self.redEdge)




"""simple docstring"""





import os

_a		       =							{'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1_000}







def 	__a     (		__lowerCamelCase  ):
   UpperCAmelCase_					:					Union[str, Any]			     =    0

   UpperCAmelCase_					:					List[str]			     =    0
   while index < len(__lowerCamelCase  ) - 1:
      UpperCAmelCase_					:					Tuple			     =    SYMBOLS[numerals[index]]
      UpperCAmelCase_					:					List[str]			     =    SYMBOLS[numerals[index + 1]]
      if current_value < next_value:
         total_value -= current_value
      else:
         total_value += current_value
      index += 1
   total_value += SYMBOLS[numerals[index]]

   return total_value







def 	__a     (		__lowerCamelCase  ):
   UpperCAmelCase_					:					List[str]			     =    ""

   UpperCAmelCase_					:					Any			     =    num // 1000
   numerals += m_count * "M"
   num %= 1000

   UpperCAmelCase_					:					Any			     =    num // 100
   if c_count == 9:
      numerals += "CM"
      c_count -= 9
   elif c_count == 4:
      numerals += "CD"
      c_count -= 4
   if c_count >= 5:
      numerals += "D"
      c_count -= 5
   numerals += c_count * "C"
   num %= 100

   UpperCAmelCase_					:					str			     =    num // 10
   if x_count == 9:
      numerals += "XC"
      x_count -= 9
   elif x_count == 4:
      numerals += "XL"
      x_count -= 4
   if x_count >= 5:
      numerals += "L"
      x_count -= 5
   numerals += x_count * "X"
   num %= 10

   if num == 9:
      numerals += "IX"
      num -= 9
   elif num == 4:
      numerals += "IV"
      num -= 4
   if num >= 5:
      numerals += "V"
      num -= 5
   numerals += num * "I"

   return numerals







def 	__a     (		__lowerCamelCase = "/p089_roman.txt"  ):
   UpperCAmelCase_					:					int			     =    0

   with open(os.path.dirname(__lowerCamelCase  ) + roman_numerals_filename  ) as filea:
      UpperCAmelCase_					:					Optional[Any]			     =    filea.readlines()

   for line in lines:
      UpperCAmelCase_					:					Tuple			     =    line.strip()
      UpperCAmelCase_					:					Optional[Any]			     =    parse_roman_numerals(__lowerCamelCase  )
      UpperCAmelCase_					:					Tuple			     =    generate_roman_numerals(__lowerCamelCase  )
      savings += len(__lowerCamelCase  ) - len(__lowerCamelCase  )

   return savings


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


