





from __future__ import annotations


def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase    ,       lowerCAmelCase					):
       print(f'''Vertex\tShortest Distance from vertex {src}'''					)
       for i, d in enumerate(lowerCAmelCase					):
              print(f'''{i}\t\t{d}'''					)


def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase    ,       lowerCAmelCase    ,       lowerCAmelCase					):
       for j in range(lowerCAmelCase					):
              _UpperCamelCase       ,		_UpperCamelCase       ,		_UpperCamelCase              =						(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     SCREAMING_SNAKE_CASE			(      lowerCAmelCase    ,       lowerCAmelCase    ,       lowerCAmelCase    ,       lowerCAmelCase					):
       _UpperCamelCase              =						[float('''inf'''					)] * vertex_count
       _UpperCamelCase              =						0.0

       for _ in range(vertex_count - 1					):
              for j in range(lowerCAmelCase					):
                     _UpperCamelCase       ,		_UpperCamelCase       ,		_UpperCamelCase              =						(graph[j][k] for k in ['''src''', '''dst''', '''weight'''])

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

       _UpperCamelCase              =						check_negative_cycle(lowerCAmelCase    ,       lowerCAmelCase    ,       lowerCAmelCase					)
       if negative_cycle_exists:
              raise Exception('''Negative cycle found'''					)

       return distance


if __name__ == "__main__":
       import doctest

       doctest.testmod()

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

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

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

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













def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase = 1_000					):
       _UpperCamelCase              =						3
       _UpperCamelCase              =						0
       while a < n:
              if a % 3 == 0 or a % 5 == 0:
                     result += a
              elif a % 15 == 0:
                     result -= a
              a += 1
       return result


if __name__ == "__main__":
       print(F'''{solution() = }''')






