



"""simple docstring"""






def      A      (			_A,     _A							):




					"""simple docstring"""
					print("\nVertex Distance"							)
					for i in range(_A							):
										if dist[i] != float("inf"							):
															print(_A,     "\t",     int(dist[i]							),     end="\t"							)
										else:
															print(_A,     "\t",     "INF",     end="\t"							)
										print()
def      A      (			_A,     _A,     _A							):




					"""simple docstring"""
					snake_case_						:Tuple								=						float("inf"							)
					snake_case_						:Optional[Any]								=						-1
					for i in range(_A							):
										if (not vset[i]) and mdist[i] < min_val:
															snake_case_						:Dict								=						i
															snake_case_						:Optional[Any]								=						mdist[i]
					return min_ind
def      A      (			_A,     _A,     _A							):




					"""simple docstring"""
					snake_case_						:Tuple								=						[float("inf"							) for _ in range(_A							)]
					snake_case_						:Optional[int]								=						[False for _ in range(_A							)]
					snake_case_						:Any								=						0.0

					for _ in range(v - 1							):
										snake_case_						:Any								=						min_dist(_A,     _A,     _A							)
										snake_case_						:Optional[Any]								=						True

										for i in range(_A							):
															if (
															    (not vset[i])
															    and graph[u][i] != float("inf"							)
															    and mdist[u] + graph[u][i] < mdist[i]
															):
																				snake_case_						:Optional[int]								=						mdist[u] + graph[u][i]

					print_dist(_A,     _A							)


if __name__ == "__main__":
				__UpperCAmelCase      :      Dict   					=					int(input('Enter number of vertices: ').strip())
				__UpperCAmelCase      :      Optional[int]   					=					int(input('Enter number of edges: ').strip())

				__UpperCAmelCase      :      List[Any]   					=					[[float('inf') for i in range(V)] for j in range(V)]

				for i in range(V):
								__UpperCAmelCase      :      List[str]   					=					0.0

				for i in range(E):
								print('\nEdge ', i + 1)
								__UpperCAmelCase      :      Optional[int]   					=					int(input('Enter source:').strip())
								__UpperCAmelCase      :      Optional[Any]   					=					int(input('Enter destination:').strip())
								__UpperCAmelCase      :      str   					=					float(input('Enter weight:').strip())
								__UpperCAmelCase      :      str   					=					weight

				__UpperCAmelCase      :      Tuple   					=					int(input('\nEnter shortest path source:').strip())
				dijkstra(graph, V, gsrc)






"""simple docstring"""






def      A      (			_A,     _A = 1_000							):




					"""simple docstring"""
					if (not isinstance(_A,     _A							)) or (digit_position <= 0):
										raise ValueError("Digit position must be a positive integer"							)
					elif (not isinstance(_A,     _A							)) or (precision < 0):
										raise ValueError("Precision must be a nonnegative integer"							)

					# compute an approximation of (16 ** (n - 1)) * pi whose fractional part is mostly
					# accurate
					snake_case_						:List[Any]								=						(
					    4 * _subsum(_A,     1,     _A							)
					    - 2 * _subsum(_A,     4,     _A							)
					    - _subsum(_A,     5,     _A							)
					    - _subsum(_A,     6,     _A							)
					)

					# return the first hex digit of the fractional part of the result
					return hex(int((sum_result % 1) * 16							)							)[2:]
def      A      (			_A,     _A,     _A							):




					"""simple docstring"""
					snake_case_						:int								=						0.0
					for sum_index in range(digit_pos_to_extract + precision							):
										snake_case_						:Optional[Any]								=						8 * sum_index + denominator_addend
										if sum_index < digit_pos_to_extract:
															# if the exponential term is an integer and we mod it by the denominator
															# before dividing, only the integer part of the sum will change;
															# the fractional part will not
															snake_case_						:List[Any]								=						pow(
															    16,     digit_pos_to_extract - 1 - sum_index,     _A							)
										else:
															snake_case_						:Optional[Any]								=						pow(16,     digit_pos_to_extract - 1 - sum_index							)
										total += exponential_term / denominator
					return total


if __name__ == "__main__":
				import doctest

				doctest.testmod()

