

'''simple docstring'''






from __future__ import annotations



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



def 			__a		(       lowerCAmelCase__ :    Optional[Any]     ,  lowerCAmelCase__ :    List[str]     ,  lowerCAmelCase__ :    Optional[Any]      ):
     for j in range(lowerCamelCase__      ):
          a__     ,    a__     ,    a__   :      Optional[int]     =						(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 			__a		(       lowerCAmelCase__ :    Any     ,  lowerCAmelCase__ :    str     ,  lowerCAmelCase__ :    int     ,  lowerCAmelCase__ :    int      ):
     a__   :      List[Any]     =						[float('''inf'''      )] * vertex_count
     a__   :      int     =						0.0

     for _ in range(vertex_count - 1      ):
          for j in range(lowerCamelCase__      ):
               a__     ,    a__     ,    a__   :      Optional[Any]     =						(graph[j][k] for k in ['''src''', '''dst''', '''weight'''])

               if distance[u] != float('''inf'''      ) and distance[u] + w < distance[v]:
                    a__   :      Optional[Any]     =						distance[u] + w

     a__   :      List[str]     =						check_negative_cycle(lowerCamelCase__     ,  lowerCamelCase__     ,  lowerCamelCase__      )
     if negative_cycle_exists:
          raise Exception('''Negative cycle found'''      )

     return distance


if __name__ == "__main__":
 import doctest

 doctest.testmod()

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

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

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

 __SCREAMING_SNAKE_CASE     =						int(input('\nEnter shortest path source:').strip())
 __SCREAMING_SNAKE_CASE     =						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''')


