


'''simple docstring'''







import os

lowerCAmelCase    :     Dict					=						{"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 1_00, """D""": 5_00, """M""": 10_00}






def 			lowercase				(_A					):







   """simple docstring"""







   _lowerCAmelCase    :							Any   			=       0

   _lowerCAmelCase    :							List[Any]   			=       0
   while index < len(_A					) - 1:
      _lowerCAmelCase    :							Tuple   			=       SYMBOLS[numerals[index]]
      _lowerCAmelCase    :							Union[str, Any]   			=       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 			lowercase				(_A					):







   """simple docstring"""







   _lowerCAmelCase    :							str   			=       ''

   _lowerCAmelCase    :							List[Any]   			=       num // 1_0_0_0
   numerals += m_count * "M"
   num %= 1_0_0_0

   _lowerCAmelCase    :							Optional[Any]   			=       num // 1_0_0
   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 %= 1_0_0

   _lowerCAmelCase    :							str   			=       num // 1_0
   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 %= 1_0

   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 			lowercase				(_A = "/p089_roman.txt"					):







   """simple docstring"""







   _lowerCAmelCase    :							Optional[int]   			=       0

   with open(os.path.dirname(_A					) + roman_numerals_filename					) as filea:
      _lowerCAmelCase    :							int   			=       filea.readlines()

   for line in lines:
      _lowerCAmelCase    :							str   			=       line.strip()
      _lowerCAmelCase    :							Union[str, Any]   			=       parse_roman_numerals(_A					)
      _lowerCAmelCase    :							Tuple   			=       generate_roman_numerals(_A					)
      savings += len(_A					) - len(_A					)

   return savings


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





'''simple docstring'''







from typing import Any






def 			lowercase				(_A					):







       """simple docstring"""







       if not input_list:
              return []
       _lowerCAmelCase    :							Optional[int]   			=       [input_list.count(_A					) for value in input_list]
       _lowerCAmelCase    :							int   			=       max(_A					)  # Gets the maximum count in the input list.
       # Gets values of modes
       return sorted({input_list[i] for i, value in enumerate(_A					) if value == y}					)


if __name__ == "__main__":
       import doctest

       doctest.testmod()

