

from __future__ import annotations

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






@dataclass
class 						__magic_name__    :
 UpperCAmelCase							    =						42
 UpperCAmelCase							    =						42






class 						__magic_name__    :


 def __init__(						self		: List[str]			,						lowerCAmelCase__		: int    )    ->      str:
   UpperCAmelCase					      =  [[] for _ in range(lowerCAmelCase__    )]
   UpperCAmelCase					      =  size


 def __getitem__(						self		: str			,						lowerCAmelCase__		: int    )    ->      Iterator[Edge]:
   return iter(self._graph[vertex]    )


 @property
 def _UpperCamelCase	(						self		: Union[str, Any]    )    ->      List[Any]:
   return self._size


 def _UpperCamelCase	(						self		: Optional[Any]			,						lowerCAmelCase__		: int			,						lowerCAmelCase__		: int			,						lowerCAmelCase__		: int    )    ->      Tuple:
   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(lowerCAmelCase__			,						lowerCAmelCase__    )    )


 def _UpperCamelCase	(						self		: str			,						lowerCAmelCase__		: int			,						lowerCAmelCase__		: int    )    ->      int | None:
   UpperCAmelCase					      =  deque([start_vertex]    )
   UpperCAmelCase					      =  [None] * self.size
   UpperCAmelCase					      =  0

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

     for edge in self[current_vertex]:
       UpperCAmelCase					      =  current_distance + edge.weight
       UpperCAmelCase					      =  distances[edge.destination_vertex]
       if (
           isinstance(lowerCAmelCase__			,						lowerCAmelCase__    )
           and new_distance >= dest_vertex_distance
       ):
         continue
       UpperCAmelCase					      =  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()






def      _lowerCAmelCase(	__A			):
  UpperCAmelCase					      =  0
  while num > 0:
    digit_sum += num % 10
    num //= 10
  return digit_sum
def      _lowerCAmelCase(	__A = 100			):
  UpperCAmelCase					      =  1
  UpperCAmelCase					      =  2

  for i in range(2   ,       max_n + 1			):
    UpperCAmelCase					      =  pre_numerator
    UpperCAmelCase					      =  2 * i // 3 if i % 3 == 0 else 1
    UpperCAmelCase					      =  cur_numerator
    UpperCAmelCase					      =  e_cont * pre_numerator + temp

  return sum_digits(__A			)


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



