



from __future__ import annotations






def 					a(   A :					int )	-> list[int]:
					"""simple docstring"""





					assert (
					    isinstance(A				,  A ) and mask > 0
					), f'''mask needs to be positive integer, your input {mask}'''
					a        =     []
					a        =     mask

					while submask:
										all_submasks.append(A )
										a        =     (submask - 1) & mask

					return all_submasks


if __name__ == "__main__":
				import doctest

				doctest.testmod()





def 					a(   A :					Optional[Any]				,  A :					List[str] )	-> List[Any]:
					"""simple docstring"""





					print("\nVertex Distance" )
					for i in range(A ):
										if dist[i] != float("inf" ):
															print(A				,  "\t"				,  int(dist[i] )				,  end="\t" )
										else:
															print(A				,  "\t"				,  "INF"				,  end="\t" )
										print()






def 					a(   A :					str				,  A :					int				,  A :					int )	-> Optional[int]:
					"""simple docstring"""





					a        =     float("inf" )
					a        =     -1
					for i in range(A ):
										if (not vset[i]) and mdist[i] < min_val:
															a        =     i
															a        =     mdist[i]
					return min_ind






def 					a(   A :					List[str]				,  A :					Union[str, Any]				,  A :					Dict )	-> Tuple:
					"""simple docstring"""





					a        =     [float("inf" ) for _ in range(A )]
					a        =     [False for _ in range(A )]
					a        =     0.0

					for _ in range(v - 1 ):
										a        =     min_dist(A				,  A				,  A )
										a        =     True

										for i in range(A ):
															if (
															    (not vset[i])
															    and graph[u][i] != float("inf" )
															    and mdist[u] + graph[u][i] < mdist[i]
															):
																				a        =     mdist[u] + graph[u][i]

					print_dist(A				,  A )


if __name__ == "__main__":
				_lowercase:				Any       =	int(input("Enter number of vertices: ").strip())
				_lowercase:				Optional[Any]       =	int(input("Enter number of edges: ").strip())

				_lowercase:				List[str]       =	[[float("inf") for i in range(V)] for j in range(V)]

				for i in range(V):
								_lowercase:				List[Any]       =	0.0

				for i in range(E):
								print("\nEdge ", i + 1)
								_lowercase:				Tuple       =	int(input("Enter source:").strip())
								_lowercase:				Tuple       =	int(input("Enter destination:").strip())
								_lowercase:				int       =	float(input("Enter weight:").strip())
								_lowercase:				str       =	weight

				_lowercase:				Union[str, Any]       =	int(input("\nEnter shortest path source:").strip())
				dijkstra(graph, V, gsrc)
