

'''simple docstring'''


from math import pi, sqrt







def 						SCREAMING_SNAKE_CASE(  UpperCamelCase  )    ->    float:
	if num <= 0:
		raise ValueError('math domain error'  )
	if num > 171.5:
		raise OverflowError('math range error'  )
	elif num - int(UpperCamelCase  ) not in (0, 0.5):
		raise NotImplementedError('num must be an integer or a half-integer'  )
	elif num == 0.5:
		return sqrt(UpperCamelCase  )
	else:
		return 1.0 if num == 1 else (num - 1) * gamma(num - 1  )







def 						SCREAMING_SNAKE_CASE(  )    ->    None:
	assert gamma(0.5  ) == sqrt(UpperCamelCase  )
	assert gamma(1  ) == 1.0
	assert gamma(2  ) == 1.0


if __name__ == "__main__":
						from doctest import testmod

						testmod()
						lowerCAmelCase__										= 1.0
						while num:
												lowerCAmelCase__										= float(input("Gamma of: "))
												print(F'gamma({num}) = {gamma(num)}')
												print("\nEnter 0 to exit...")









'''simple docstring'''


import math



class 					lowercase						:


							def __init__(			self    ,			_snake_case=0)							->				Union[str, Any]:  # a graph with Node 0,1,...,N-1
								UpperCAmelCase_		:      Tuple       	=					n
								UpperCAmelCase_		:      Optional[Any]       	=					[
								    [math.inf for j in range(0    ,			_snake_case)] for i in range(0    ,			_snake_case)
								]  # adjacency matrix for weight
								UpperCAmelCase_		:      Tuple       	=					[
								    [math.inf for j in range(0    ,			_snake_case)] for i in range(0    ,			_snake_case)
								]  # dp[i][j] stores minimum distance from i to j


							def 						_snake_case							(			self    ,			_snake_case    ,			_snake_case    ,			_snake_case)							->				List[Any]:
								UpperCAmelCase_		:      Union[str, Any]       	=					w


							def 						_snake_case							(			self)							->				str:
								for k in range(0    ,			self.n):
									for i in range(0    ,			self.n):
										for j in range(0    ,			self.n):
											UpperCAmelCase_		:      Optional[int]       	=					min(self.dp[i][j]    ,			self.dp[i][k] + self.dp[k][j])





							def 						_snake_case							(			self    ,			_snake_case    ,			_snake_case)							->				str:
								return self.dp[u][v]


if __name__ == "__main__":
						lowerCAmelCase__										= Graph(5)
						graph.add_edge(0, 2, 9)
						graph.add_edge(0, 4, 10)
						graph.add_edge(1, 3, 5)
						graph.add_edge(2, 3, 7)
						graph.add_edge(3, 0, 10)
						graph.add_edge(3, 1, 2)
						graph.add_edge(3, 2, 1)
						graph.add_edge(3, 4, 6)
						graph.add_edge(4, 1, 3)
						graph.add_edge(4, 2, 4)
						graph.add_edge(4, 3, 9)
						graph.floyd_warshall()
						graph.show_min(1, 4)
						graph.show_min(0, 3)






