


'''simple docstring'''







from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass


@dataclass
class  lowerCAmelCase_						:





  """simple docstring"""



  a_       :int
  a_       :int


class  lowerCAmelCase_						:





  """simple docstring"""



  def __init__(					self     :							Optional[int]				,							SCREAMING_SNAKE_CASE__     :							int						):





       '''simple docstring'''

       __a       =   [[] for _ in range(SCREAMING_SNAKE_CASE__						)]
       __a       =   size

  def __getitem__(					self     :							List[Any]				,							SCREAMING_SNAKE_CASE__     :							int						):





       '''simple docstring'''

       return iter(self._graph[vertex]						)

  @property
  def __a						(					self     :							List[str]						):





       '''simple docstring'''

       return self._size

  def __a						(					self     :							Optional[Any]				,							SCREAMING_SNAKE_CASE__     :							int				,							SCREAMING_SNAKE_CASE__     :							int				,							SCREAMING_SNAKE_CASE__     :							int						):





       '''simple docstring'''

       if weight not in (0, 1):
            raise ValueError("""Edge weight must be either 0 or 1."""						)

       if to_vertex < 0 or to_vertex >= self.size:
            raise ValueError("""Vertex indexes must be in [0; size)."""						)

       self._graph[from_vertex].append(Edge(SCREAMING_SNAKE_CASE__				,							SCREAMING_SNAKE_CASE__						)						)


  def __a						(					self     :							Dict				,							SCREAMING_SNAKE_CASE__     :							int				,							SCREAMING_SNAKE_CASE__     :							int						):





       '''simple docstring'''

       __a       =   deque([start_vertex]						)
       __a       =   [None] * self.size
       __a       =   0

       while queue:
            __a       =   queue.popleft()
            __a       =   distances[current_vertex]
            if current_distance is None:
                 continue

            for edge in self[current_vertex]:
                 __a       =   current_distance + edge.weight
                 __a       =   distances[edge.destination_vertex]
                 if (
                     isinstance(SCREAMING_SNAKE_CASE__				,							SCREAMING_SNAKE_CASE__						)
                     and new_distance >= dest_vertex_distance
                 ):
                      continue
                 __a       =   new_distance
                 if edge.weight == 0:
                      queue.appendleft(edge.destination_vertex						)
                 else:
                      queue.append(edge.destination_vertex						)

       if distances[finish_vertex] is None:
            raise ValueError("""No path from start_vertex to finish_vertex."""						)

       return distances[finish_vertex]


if __name__ == "__main__":
 import doctest

 doctest.testmod()










'''simple docstring'''







from math import pi, sqrt




def        __lowercase						(      __SCREAMING_SNAKE_CASE		)				->					float:
     """simple docstring"""




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




def        __lowercase						(      )				->					None:
     """simple docstring"""




     assert gamma(0.5		) == sqrt(__SCREAMING_SNAKE_CASE		)
     assert gamma(1		) == 1.0
     assert gamma(2		) == 1.0


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

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






