




'''simple docstring'''





def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int = 1_0_0_0  ):

							'''simple docstring'''






							if (not isinstance(snake_case							,       snake_case  )) or (digit_position <= 0):
														raise ValueError("Digit position must be a positive integer"  )
							elif (not isinstance(snake_case							,       snake_case  )) 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_			      =   (
							    4 * _subsum(snake_case							,       1							,       snake_case  )
							    - 2 * _subsum(snake_case							,       4							,       snake_case  )
							    - _subsum(snake_case							,       5							,       snake_case  )
							    - _subsum(snake_case							,       6							,       snake_case  )
							)

							# return the first hex digit of the fractional part of the result
							return hex(int((sum_result % 1) * 1_6  )  )[2:]


def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int							,       snake_case							: int  ):

							'''simple docstring'''






							snake_case_			      =   0.0
							for sum_index in range(digit_pos_to_extract + precision  ):
														snake_case_			      =   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_			      =   pow(
																					    1_6							,       digit_pos_to_extract - 1 - sum_index							,       snake_case  )
														else:
																					snake_case_			      =   pow(1_6							,       digit_pos_to_extract - 1 - sum_index  )
														total += exponential_term / denominator
							return total


if __name__ == "__main__":
		import doctest

		doctest.testmod()










'''simple docstring'''





import heapq


def   UpperCamelCase_(			snake_case							: List[Any]							,       snake_case							: List[str]							,       snake_case							: Dict  ):

							'''simple docstring'''






							snake_case_			      =   [(0, start)]  # cost from start node,end node
							snake_case_			      =   set()
							while heap:
														((snake_case_)      ,   (snake_case_))			      =   heapq.heappop(snake_case  )
														if u in visited:
																					continue
														visited.add(snake_case  )
														if u == end:
																					return cost
														for v, c in graph[u]:
																					if v in visited:
																												continue
																					snake_case_			      =   cost + c
																					heapq.heappush(snake_case							,       (next_item, v)  )
							return -1


_SCREAMING_SNAKE_CASE							:     Dict   	=				{
    "A": [["B", 2], ["C", 5]],
    "B": [["A", 2], ["D", 3], ["E", 1], ["F", 1]],
    "C": [["A", 5], ["F", 3]],
    "D": [["B", 3]],
    "E": [["B", 4], ["F", 3]],
    "F": [["C", 3], ["E", 3]],
}
_SCREAMING_SNAKE_CASE							:     Optional[int]   	=				{
    "B": [["C", 1]],
    "C": [["D", 1]],
    "D": [["F", 1]],
    "E": [["B", 1], ["F", 3]],
    "F": [],
}
_SCREAMING_SNAKE_CASE							:     Any   	=				{
    "B": [["C", 1]],
    "C": [["D", 1]],
    "D": [["F", 1]],
    "E": [["B", 1], ["G", 2]],
    "F": [],
    "G": [["F", 1]],
}

_SCREAMING_SNAKE_CASE							:     Tuple   	=				dijkstra(G, "E", "C")
print(short_distance)  # E -- 3 --> F -- 3 --> C == 6

_SCREAMING_SNAKE_CASE							:     str   	=				dijkstra(Ga, "E", "F")
print(short_distance)  # E -- 3 --> F == 3

_SCREAMING_SNAKE_CASE							:     List[Any]   	=				dijkstra(Ga, "E", "F")
print(short_distance)  # E -- 2 --> G -- 1 --> F == 3

if __name__ == "__main__":
		import doctest

		doctest.testmod()




