

"""simple docstring"""




import math



class 			lowerCAmelCase_		:


				"""simple docstring"""



				def __init__(self     , SCREAMING_SNAKE_CASE__=0					)      ->	List[Any]:  # a graph with Node 0,1,...,N-1



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: Optional[Any]     =     n
											SCREAMING_SNAKE_CASE__		: Dict     =     [
											    [math.inf for j in range(0     , SCREAMING_SNAKE_CASE__					)] for i in range(0     , SCREAMING_SNAKE_CASE__					)
											]  # adjacency matrix for weight
											SCREAMING_SNAKE_CASE__		: List[str]     =     [
											    [math.inf for j in range(0     , SCREAMING_SNAKE_CASE__					)] for i in range(0     , SCREAMING_SNAKE_CASE__					)
											]  # dp[i][j] stores minimum distance from i to j



				def 			__magic_name__					(self     , SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__     , SCREAMING_SNAKE_CASE__					)      ->	str:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__		: int     =     w



				def 			__magic_name__					(self					)      ->	Any:



											"""simple docstring"""




											for k in range(0     , self.n					):
																		for i in range(0     , self.n					):
																									for j in range(0     , self.n					):
																																SCREAMING_SNAKE_CASE__		: Tuple     =     min(self.dp[i][j]     , self.dp[i][k] + self.dp[k][j]					)



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



											"""simple docstring"""




											return self.dp[u][v]


if __name__ == "__main__":
					UpperCAmelCase__   :					Optional[Any]												=				Graph(5)
					graph.add_edge(0, 2, 9)
					graph.add_edge(0, 4, 1_0)
					graph.add_edge(1, 3, 5)
					graph.add_edge(2, 3, 7)
					graph.add_edge(3, 0, 1_0)
					graph.add_edge(3, 1, 2)
					graph.add_edge(3, 2, 1)
					graph.add_edge(3, 4, 6)
					graph.add_edge(4, 1, 3)
					graph.add_edge(4, 2, 4)
					graph.add_edge(4, 3, 9)
					graph.floyd_warshall()
					graph.show_min(1, 4)
					graph.show_min(0, 3)






"""simple docstring"""




UpperCAmelCase__   :					Dict												=				[
    (1_0_0_0, 'M'),
    (9_0_0, 'CM'),
    (5_0_0, 'D'),
    (4_0_0, 'CD'),
    (1_0_0, 'C'),
    (9_0, 'XC'),
    (5_0, 'L'),
    (4_0, 'XL'),
    (1_0, 'X'),
    (9, 'IX'),
    (5, 'V'),
    (4, 'IV'),
    (1, 'I'),
]

def lowercase_						(     _snake_case		):
							SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     {"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 100, """D""": 500, """M""": 1_000}
							SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     0
							SCREAMING_SNAKE_CASE__		: Union[str, Any]     =     0
							while place < len(_snake_case		):
														if (place + 1 < len(_snake_case		)) and (vals[roman[place]] < vals[roman[place + 1]]):
																					total += vals[roman[place + 1]] - vals[roman[place]]
																					place += 2
														else:
																					total += vals[roman[place]]
																					place += 1
							return total

def lowercase_						(     _snake_case		):
							SCREAMING_SNAKE_CASE__		: Optional[Any]     =     []
							for arabic, roman in ROMAN:
														((SCREAMING_SNAKE_CASE__)   ,   (SCREAMING_SNAKE_CASE__))		: List[Any]     =     divmod(_snake_case     ,_snake_case		)
														result.append(roman * factor		)
														if number == 0:
																					break
							return "".join(_snake_case		)


if __name__ == "__main__":
					import doctest

					doctest.testmod()




