



"""simple docstring"""





from __future__ import annotations




def 	UpperCAmelCase     (		A	:						Union[str, Any]     ,				A	:						Any       ):

		'''simple docstring'''


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




def 	UpperCAmelCase     (		A	:						List[str]     ,				A	:						Optional[Any]     ,				A	:						str       ):

		'''simple docstring'''


		for j in range(SCREAMING_SNAKE_CASE_       ):
				_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 	UpperCAmelCase     (		A	:						str     ,				A	:						int     ,				A	:						List[str]     ,				A	:						int       ):

		'''simple docstring'''


		_UpperCAmelCase							 =		[float('inf'       )] * vertex_count
		_UpperCAmelCase							 =		0.0

		for _ in range(vertex_count - 1       ):
				for j in range(SCREAMING_SNAKE_CASE_       ):
						_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(SCREAMING_SNAKE_CASE_     ,				SCREAMING_SNAKE_CASE_     ,				SCREAMING_SNAKE_CASE_       )
		if negative_cycle_exists:
				raise Exception('Negative cycle found'       )

		return distance


if __name__ == "__main__":
							import doctest

							doctest.testmod()

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

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

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

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







"""simple docstring"""





from itertools import permutations




def 	UpperCAmelCase     (		A	:						tuple       ):

		'''simple docstring'''


		if num[3] % 2 != 0:
				return False

		if (num[2] + num[3] + num[4]) % 3 != 0:
				return False

		if num[5] % 5 != 0:
				return False

		_UpperCAmelCase							 =		[7, 11, 13, 17]
		for i, test in enumerate(A       ):
				if (num[i + 4] * 100 + num[i + 5] * 10 + num[i + 6]) % test != 0:
						return False
		return True




def 	UpperCAmelCase     (		A	:						int = 10       ):

		'''simple docstring'''


		return sum(
		    int(''.join(map(A     ,				A       )       )       )
		    for num in permutations(range(A       )       )
		    if is_substring_divisible(A       )       )


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


