




from __future__ import annotations

from collections.abc import Generator
def    snake_case_	(						)     ->					Generator[int, None, None]:
							lowercase__    :			dict[int, int]     =				{}
							lowercase__    :			int     =				2
							while True:
														lowercase__    :			Tuple     =				factor_map.pop(lowerCAmelCase__							,lowerCAmelCase__							)
														if factor:
																					lowercase__    :			Optional[Any]     =				factor + prime
																					while x in factor_map:
																												x += factor
																					lowercase__    :			Any     =				factor
														else:
																					lowercase__    :			Optional[Any]     =				prime
																					yield prime
														prime += 1
def    snake_case_	(						SCREAMING_SNAKE_CASE_ = 1E10							)     ->					int:
							lowercase__    :			List[str]     =				sieve()

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


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






"""simple docstring"""






from __future__ import annotations






def      lowercase__ (					lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int			)    ->			tuple[int, int]:



			'''simple docstring'''
			if b == 0:
						return (1, 0)
			((a__) ,	(a__))  :	List[Any]		 =			extended_euclid(lowerCAmelCase__							,			a % b			)
			a__  :	str		 =			a // b
			return (y, x - k * y)






def      lowercase__ (					lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int			)    ->			int:



			'''simple docstring'''
			((a__) ,	(a__))  :	Tuple		 =			extended_euclid(lowerCAmelCase__							,			lowerCAmelCase__			)
			a__  :	List[str]		 =			na * na
			a__  :	Union[str, Any]		 =			ra * x * na + ra * y * na
			return (n % m + m) % m






def      lowercase__ (					lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int			)    ->			int:



			'''simple docstring'''
			((a__) ,	(a__))  :	Optional[Any]		 =			extended_euclid(lowerCAmelCase__							,			lowerCAmelCase__			)
			if b < 0:
						a__  :	Optional[int]		 =			(b % n + n) % n
			return b






def      lowercase__ (					lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int							,			lowerCAmelCase__   :			int			)    ->			int:



			'''simple docstring'''
			a__ ,	a__  :	List[Any]		 =			invert_modulo(lowerCAmelCase__							,			lowerCAmelCase__			), invert_modulo(lowerCAmelCase__							,			lowerCAmelCase__			)
			a__  :	Dict		 =			na * na
			a__  :	Any		 =			ra * x * na + ra * y * na
			return (n % m + m) % m


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

		testmod(name='''chinese_remainder_theorem''', verbose=True)
		testmod(name='''chinese_remainder_theorem2''', verbose=True)
		testmod(name='''invert_modulo''', verbose=True)
		testmod(name='''extended_euclid''', verbose=True)