





from copy import deepcopy



class 					__lowerCAmelCase       :






			def __init__(self					,							__magic_name__ = None					,							__magic_name__ = None    )     ->   None:


							'''simple docstring'''



							if arr is None and size is not None:
											snake_case_						:    str				=  size
											snake_case_						:    List[Any]				=  [0] * size
							elif arr is not None:
											self.init(__magic_name__    )
							else:
											raise ValueError('''Either arr or size must be specified'''    )






			def 			lowerCamelCase  (self					,							__magic_name__    )     ->   None:


							'''simple docstring'''



							snake_case_						:    Optional[Any]				=  len(__magic_name__    )
							snake_case_						:    str				=  deepcopy(__magic_name__    )
							for i in range(1					,							self.size    ):
											snake_case_						:    int				=  self.next_(__magic_name__    )
											if j < self.size:
															self.tree[j] += self.tree[i]






			def 			lowerCamelCase  (self    )     ->   list[int]:


							'''simple docstring'''



							snake_case_						:    int				=  self.tree[:]
							for i in range(self.size - 1					,							0					,							-1    ):
											snake_case_						:    List[Any]				=  self.next_(__magic_name__    )
											if j < self.size:
															arr[j] -= arr[i]
							return arr






			@staticmethod
			def 			lowerCamelCase  (__magic_name__    )     ->   int:


							'''simple docstring'''



							return index + (index & (-index))






			@staticmethod
			def 			lowerCamelCase  (__magic_name__    )     ->   int:


							'''simple docstring'''



							return index - (index & (-index))






			def 			lowerCamelCase  (self					,							__magic_name__					,							__magic_name__    )     ->   None:


							'''simple docstring'''



							if index == 0:
											self.tree[0] += value
											return
							while index < self.size:
											self.tree[index] += value
											snake_case_						:    str				=  self.next_(__magic_name__    )






			def 			lowerCamelCase  (self					,							__magic_name__					,							__magic_name__    )     ->   None:


							'''simple docstring'''



							self.add(__magic_name__					,							value - self.get(__magic_name__    )    )






			def 			lowerCamelCase  (self					,							__magic_name__    )     ->   int:


							'''simple docstring'''



							if right == 0:
											return 0
							snake_case_						:    Optional[Any]				=  self.tree[0]
							right -= 1  # make right inclusive
							while right > 0:
											result += self.tree[right]
											snake_case_						:    List[Any]				=  self.prev(__magic_name__    )
							return result






			def 			lowerCamelCase  (self					,							__magic_name__					,							__magic_name__    )     ->   int:


							'''simple docstring'''



							return self.prefix(__magic_name__    ) - self.prefix(__magic_name__    )






			def 			lowerCamelCase  (self					,							__magic_name__    )     ->   int:


							'''simple docstring'''



							return self.query(__magic_name__					,							index + 1    )






			def 			lowerCamelCase  (self					,							__magic_name__    )     ->   int:


							'''simple docstring'''



							value -= self.tree[0]
							if value < 0:
											return -1

							snake_case_						:    Tuple				=  1  # Largest power of 2 <= size
							while j * 2 < self.size:
											j *= 2

							snake_case_						:    int				=  0

							while j > 0:
											if i + j < self.size and self.tree[i + j] <= value:
															value -= self.tree[i + j]
															i += j
											j //= 2
							return i


if __name__ == "__main__":
	import doctest

	doctest.testmod()







def      lowerCamelCase_						(				_UpperCamelCase ,				_UpperCamelCase )		->						List[str]:






				"""simple docstring"""


				print('''\nThe shortest path matrix using Floyd Warshall algorithm\n''' )
				for i in range(_UpperCamelCase ):
								for j in range(_UpperCamelCase ):
												if dist[i][j] != float('''inf''' ):
																print(int(dist[i][j] ) ,				end='''\t''' )
												else:
																print('''INF''' ,				end='''\t''' )
								print()






def      lowerCamelCase_						(				_UpperCamelCase ,				_UpperCamelCase )		->						Union[str, Any]:






				"""simple docstring"""


				snake_case_						:    int				=  [[float('''inf''' ) for _ in range(_UpperCamelCase )] for _ in range(_UpperCamelCase )]

				for i in range(_UpperCamelCase ):
								for j in range(_UpperCamelCase ):
												snake_case_						:    Dict				=  graph[i][j]

												# check vertex k against all other vertices (i, j)
				for k in range(_UpperCamelCase ):
								# looping through rows of graph array
								for i in range(_UpperCamelCase ):
												# looping through columns of graph array
												for j in range(_UpperCamelCase ):
																if (
																    dist[i][k] != float('''inf''' )
																    and dist[k][j] != float('''inf''' )
																    and dist[i][k] + dist[k][j] < dist[i][j]
																):
																				snake_case_						:    List[Any]				=  dist[i][k] + dist[k][j]

				_print_dist(_UpperCamelCase ,				_UpperCamelCase )
				return dist, v


if __name__ == "__main__":
	lowerCAmelCase_    =				int(input('''Enter number of vertices: '''))
	lowerCAmelCase_    =				int(input('''Enter number of edges: '''))

	lowerCAmelCase_    =				[[float('''inf''') for i in range(v)] for j in range(v)]

	for i in range(v):
		lowerCAmelCase_    =				0.0

		# src and dst are indices that must be within the array size graph[e][v]
		# failure to follow this will result in an error
	for i in range(e):
		print('''\nEdge ''', i + 1)
		lowerCAmelCase_    =				int(input('''Enter source:'''))
		lowerCAmelCase_    =				int(input('''Enter destination:'''))
		lowerCAmelCase_    =				float(input('''Enter weight:'''))
		lowerCAmelCase_    =				weight

	floyd_warshall(graph, v)

	# Example Input
	# Enter number of vertices: 3
	# Enter number of edges: 2

	# # generated graph from vertex and edge inputs
	# [[inf, inf, inf], [inf, inf, inf], [inf, inf, inf]]
	# [[0.0, inf, inf], [inf, 0.0, inf], [inf, inf, 0.0]]

	# specify source, destination and weight for edge #1
	# Edge  1
	# Enter source:1
	# Enter destination:2
	# Enter weight:2

	# specify source, destination and weight for edge #2
	# Edge  2
	# Enter source:2
	# Enter destination:1
	# Enter weight:1

	# # Expected Output from the vertice, edge and src, dst, weight inputs!!
	# 0		INF	INF
	# INF	0	2
	# INF	1	0
