
from __future__ import annotations





def      lowerCamelCase_					(							lowerCamelCase__      ,					lowerCamelCase__       ):
				print(F'Vertex\tShortest Distance from vertex {src}'       )
				for i, d in enumerate(lowerCamelCase__       ):
								print(F'{i}\t\t{d}'       )





def      lowerCamelCase_					(							lowerCamelCase__      ,					lowerCamelCase__      ,					lowerCamelCase__       ):
				for j in range(lowerCamelCase__       ):
								lowerCamelCase_      ,       lowerCamelCase_      ,       lowerCamelCase_         =     (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      lowerCamelCase_					(							lowerCamelCase__      ,					lowerCamelCase__      ,					lowerCamelCase__      ,					lowerCamelCase__       ):
				lowerCamelCase_         =     [float("inf"       )] * vertex_count
				lowerCamelCase_         =     0.0

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

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

				lowerCamelCase_         =     check_negative_cycle(lowerCamelCase__      ,					lowerCamelCase__      ,					lowerCamelCase__       )
				if negative_cycle_exists:
								raise Exception("Negative cycle found"       )

				return distance


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			__A							=int(input('''Enter number of vertices: ''').strip())
			__A							=int(input('''Enter number of edges: ''').strip())

			__A							=[{} for _ in range(E)]

			for i in range(E):
						print('''Edge ''', i + 1)
						__A,		__A,		__A							=(
						    int(x)
						    for x in input('''Enter source, destination, weight: ''').strip().split(''' ''')
						)
						__A							={'''src''': src, '''dst''': dest, '''weight''': weight}

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




import math





def      lowerCamelCase_					(							lowerCamelCase__      ,					lowerCamelCase__       ):
				if 0 not in (x, y):
								# We use the relation x^y = y*log10(x), where 10 is the base.
								return y * math.logaa(lowerCamelCase__       )
				else:
								if x == 0:  # 0 raised to any number is 0
												return 0
								elif y == 0:
												return 1  # any number raised to 0 is 1
				raise AssertionError("This should never happen"       )


if __name__ == "__main__":  # Main function
			# Read two numbers from input and typecast them to int using map function.
			# Here x is the base and y is the power.
			__A							='''Enter the base and the power separated by a comma: '''
			__A,		__A							=map(int, input(prompt).split(''','''))
			__A,		__A							=map(int, input(prompt).split(''','''))

			# We find the log of each number, using the function res(), which takes two
			# arguments.
			__A							=res(xa, ya)
			__A							=res(xa, ya)

			# We check for the largest number
			if resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			elif resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			else:
						print('''Both are equal''')


