





from __future__ import annotations







def    A				(							UpperCAmelCase  ,  UpperCAmelCase				):
					print(F"""Vertex\tShortest Distance from vertex {src}"""				)
					for i, d in enumerate(UpperCAmelCase				):
										print(F"""{i}\t\t{d}"""				)







def    A				(							UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase				):
					for j in range(UpperCAmelCase				):
										_snake_case       :					List[str]				       =   (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				(							UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase				):
					_snake_case       :					Optional[int]				       =   [float("inf"				)] * vertex_count
					_snake_case       :					Tuple				       =   0.0

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

															if distance[u] != float("inf"				) and distance[u] + w < distance[v]:
																				_snake_case       :					Union[str, Any]				       =   distance[u] + w

					_snake_case       :					Optional[int]				       =   check_negative_cycle(UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase				)
					if negative_cycle_exists:
										raise Exception("Negative cycle found"				)

					return distance


if __name__ == "__main__":
							import doctest

							doctest.testmod()

							__lowerCAmelCase :Tuple     =    int(input('Enter number of vertices: ').strip())
							__lowerCAmelCase :List[Any]     =    int(input('Enter number of edges: ').strip())

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

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

							__lowerCAmelCase :List[str]     =    int(input('\nEnter shortest path source:').strip())
							__lowerCAmelCase :Tuple     =    bellman_ford(graph, V, E, source)
							print_distance(shortest_distance, 0)






import sys
import turtle







def    A				(							UpperCAmelCase  ,  UpperCAmelCase				):
					return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2







def    A				(							UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  ):
					my_pen.up()
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)
					my_pen.down()
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)
					my_pen.goto(vertexa[0]  ,  vertexa[1]				)

					if depth == 0:
										return

					triangle(UpperCAmelCase  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  depth - 1				)
					triangle(UpperCAmelCase  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  depth - 1				)
					triangle(UpperCAmelCase  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  get_mid(UpperCAmelCase  ,  UpperCAmelCase				)  ,  depth - 1				)


if __name__ == "__main__":
							if len(sys.argv) != 2:
														raise ValueError(
														    'Correct format for using this script: '
														    'python fractals.py <int:depth_for_fractal>'
														)
							__lowerCAmelCase :Any     =    turtle.Turtle()
							my_pen.ht()
							my_pen.speed(5)
							my_pen.pencolor('red')

							__lowerCAmelCase :Optional[int]     =    [(-1_75, -1_25), (0, 1_75), (1_75, -1_25)]  # vertices of triangle
							triangle(vertices[0], vertices[1], vertices[2], int(sys.argv[1]))