"""simple docstring"""







import os

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



def 			lowercase__(       __SCREAMING_SNAKE_CASE							:     Optional[int]      ):
     lowercase_	:				Tuple													=	0

     lowercase_	:				Dict													=	0
     while index < len(_snake_case      ) - 1:
          lowercase_	:				List[Any]													=	SYMBOLS[numerals[index]]
          lowercase_	:				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 			lowercase__(       __SCREAMING_SNAKE_CASE							:     Union[str, Any]      ):
     lowercase_	:				Union[str, Any]													=	""""""

     lowercase_	:				str													=	num // 10_00
     numerals += m_count * "M"
     num %= 10_00

     lowercase_	:				str													=	num // 1_00
     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_00

     lowercase_	:				int													=	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 			lowercase__(       __SCREAMING_SNAKE_CASE							:     int = "/p089_roman.txt"      ):
     lowercase_	:				Dict													=	0

     with open(os.path.dirname(_snake_case      ) + roman_numerals_filename      ) as filea:
          lowercase_	:				Optional[int]													=	filea.readlines()

     for line in lines:
          lowercase_	:				List[Any]													=	line.strip()
          lowercase_	:				str													=	parse_roman_numerals(_snake_case      )
          lowercase_	:				Optional[int]													=	generate_roman_numerals(_snake_case      )
          savings += len(_snake_case      ) - len(_snake_case      )

     return savings


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



"""simple docstring"""




def lowercase_  (   _snake_case						):
							SCREAMING_SNAKE_CASE__						:       Optional[int]           =   [1]

							SCREAMING_SNAKE_CASE__      ,      SCREAMING_SNAKE_CASE__      ,      SCREAMING_SNAKE_CASE__						:       str           =   0, 0, 0
							SCREAMING_SNAKE_CASE__						:       List[str]           =   ugly_nums[ia] * 2
							SCREAMING_SNAKE_CASE__						:       int           =   ugly_nums[ia] * 3
							SCREAMING_SNAKE_CASE__						:       Any           =   ugly_nums[ia] * 5

							for _ in range(1   ,_snake_case						):
														SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   min(_snake_case   ,_snake_case   ,_snake_case						)
														ugly_nums.append(_snake_case						)
														if next_num == next_a:
																					ia += 1
																					SCREAMING_SNAKE_CASE__						:       Optional[int]           =   ugly_nums[ia] * 2
														if next_num == next_a:
																					ia += 1
																					SCREAMING_SNAKE_CASE__						:       List[str]           =   ugly_nums[ia] * 3
														if next_num == next_a:
																					ia += 1
																					SCREAMING_SNAKE_CASE__						:       Tuple           =   ugly_nums[ia] * 5
							return ugly_nums[-1]


if __name__ == "__main__":
					from doctest import testmod

					testmod(verbose=True)
					print(f"""{ugly_numbers(2_0_0) = }""")




