



from __future__ import annotations
def  UpperCamelCase						(       _A			:				list[float]			,							_A			:				Any    )->       Optional[int]:





						"""simple docstring"""





						print(f"""Vertex\tShortest Distance from vertex {src}"""    )
						for i, d in enumerate(_A    ):
												print(f"""{i}\t\t{d}"""    )
def  UpperCamelCase						(       _A			:				list[dict[str, int]]			,							_A			:				list[float]			,							_A			:				int    )->       Optional[int]:





						"""simple docstring"""





						for j in range(_A    ):
												A__						,       A__						,       A__							=       (graph[j][k] for k in ["src", "dst", "weight"])
												if distance[u] != float("inf"    ) and distance[u] + w < distance[v]:
																		return True
						return False
def  UpperCamelCase						(       _A			:				list[dict[str, int]]			,							_A			:				int			,							_A			:				int			,							_A			:				int    )->       list[float]:





						"""simple docstring"""





						A__							=       [float("inf"    )] * vertex_count
						A__							=       0.0

						for _ in range(vertex_count - 1    ):
												for j in range(_A    ):
																		A__						,       A__						,       A__							=       (graph[j][k] for k in ["src", "dst", "weight"])

																		if distance[u] != float("inf"    ) and distance[u] + w < distance[v]:
																								A__							=       distance[u] + w

						A__							=       check_negative_cycle(_A			,							_A			,							_A    )
						if negative_cycle_exists:
												raise Exception("Negative cycle found"    )

						return distance


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						UpperCAmelCase_							:      List[str]      =  int(input("Enter number of vertices: ").strip())
						UpperCAmelCase_							:      Any      =  int(input("Enter number of edges: ").strip())

						UpperCAmelCase_							:      list[dict[str, int]]      =  [{} for _ in range(E)]

						for i in range(E):
												print("Edge ", i + 1)
												UpperCAmelCase_   ,	UpperCAmelCase_   ,	UpperCAmelCase_							:      Any      =  (
												    int(x)
												    for x in input("Enter source, destination, weight: ").strip().split(" ")
												)
												UpperCAmelCase_							:      Union[str, Any]      =  {"src": src, "dst": dest, "weight": weight}

						UpperCAmelCase_							:      Any      =  int(input("\nEnter shortest path source:").strip())
						UpperCAmelCase_							:      Any      =  bellman_ford(graph, V, E, source)
						print_distance(shortest_distance, 0)










def  UpperCamelCase						(       _A			:				int			,							_A			:				int    )->       int:





						"""simple docstring"""





						return int((input_a, input_a).count(0    ) == 0    )
def  UpperCamelCase						(       )->       None:





						"""simple docstring"""





						assert and_gate(0			,							0    ) == 0
						assert and_gate(0			,							1    ) == 0
						assert and_gate(1			,							0    ) == 0
						assert and_gate(1			,							1    ) == 1


if __name__ == "__main__":
						test_and_gate()
						print(and_gate(1, 0))
						print(and_gate(0, 0))
						print(and_gate(0, 1))
						print(and_gate(1, 1))





