

from __future__ import annotations

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





@dataclass
class 	snake_case_   :







			'''simple docstring'''

			SCREAMING_SNAKE_CASE     :   int
			SCREAMING_SNAKE_CASE     :   int






class 	snake_case_   :







			'''simple docstring'''

			def __init__(     self :				Dict							,   _UpperCamelCase :				int							)      ->int:
									snake_case_   =	[[] for _ in range(_UpperCamelCase							)]
									snake_case_   =	size







			def __getitem__(     self :				Optional[Any]							,   _UpperCamelCase :				int							)      ->Iterator[Edge]:
									return iter(self._graph[vertex]							)







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







			def 				snake_case__(     self :				List[str]							,   _UpperCamelCase :				int							,   _UpperCamelCase :				int							,   _UpperCamelCase :				int							)      ->Dict:
									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(_UpperCamelCase							,   _UpperCamelCase							)							)







			def 				snake_case__(     self :				Dict							,   _UpperCamelCase :				int							,   _UpperCamelCase :				int							)      ->int | None:
									snake_case_   =	deque([start_vertex]							)
									snake_case_   =	[None] * self.size
									snake_case_   =	0

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

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


from __future__ import annotations

from collections.abc import Generator


def   __SCREAMING_SNAKE_CASE					():
						snake_case_   =	{}
						snake_case_   =	2
						while True:
												snake_case_   =	factor_map.pop(SCREAMING_SNAKE_CASE__  ,		SCREAMING_SNAKE_CASE__       )
												if factor:
																		snake_case_   =	factor + prime
																		while x in factor_map:
																								x += factor
																		snake_case_   =	factor
												else:
																		snake_case_   =	prime
																		yield prime
												prime += 1


def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__ = 1E10       ):
						snake_case_   =	sieve()

						snake_case_   =	1
						while True:
												snake_case_   =	next(SCREAMING_SNAKE_CASE__       )
												if (2 * prime * n) > limit:
																		return n
												# Ignore the next prime as the reminder will be 2.
												next(SCREAMING_SNAKE_CASE__       )
												n += 2


if __name__ == "__main__":
					print(solution())