



"""simple docstring"""






from math import isclose, sqrt






def      snake_case__   (		__lowerCamelCase				:    float							,		__lowerCamelCase				:    float							,		__lowerCamelCase				:    float	):
			"""simple docstring"""
			lowerCamelCase__		:		str			=point_y / 4 / point_x
			lowerCamelCase__		:		Any			=2 * normal_gradient / (1 + normal_gradient * normal_gradient)
			lowerCamelCase__		:		Optional[Any]			=(1 - normal_gradient * normal_gradient) / (
			    1 + normal_gradient * normal_gradient
			)
			lowerCamelCase__		:		Optional[int]			=(sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

			# to find the next point, solve the simultaeneous equations:
			# y^2 + 4x^2 = 100
			# y - b = m * (x - a)
			# ==> A x^2 + B x + C = 0
			lowerCamelCase__		:		List[str]			=outgoing_gradient**2 + 4
			lowerCamelCase__		:		Optional[Any]			=2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
			lowerCamelCase__		:		Union[str, Any]			=(point_y - outgoing_gradient * point_x) ** 2 - 100

			lowerCamelCase__		:		Optional[int]			=(
			    -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term	)
			) / (2 * quadratic_term)
			lowerCamelCase__		:		Tuple			=(
			    -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term	)
			) / (2 * quadratic_term)

			# two solutions, one of which is our input point
			lowerCamelCase__		:		Union[str, Any]			=x_minus if isclose(__lowerCamelCase							,		__lowerCamelCase	) else x_plus
			lowerCamelCase__		:		Optional[Any]			=point_y + outgoing_gradient * (next_x - point_x)

			return next_x, next_y, outgoing_gradient






def      snake_case__   (		__lowerCamelCase				:    float = 1.4							,		__lowerCamelCase				:    float = -9.6	):
			"""simple docstring"""
			lowerCamelCase__		:		int			=0
			lowerCamelCase__		:		float			=first_x_coord
			lowerCamelCase__		:		float			=first_y_coord
			lowerCamelCase__		:		float			=(10.1 - point_y) / (0.0 - point_x)

			while not (-0.01 <= point_x <= 0.01 and point_y > 0):
						lowerCamelCase__	,   lowerCamelCase__	,   lowerCamelCase__		:		Optional[int]			=next_point(__lowerCamelCase							,		__lowerCamelCase							,		__lowerCamelCase	)
						num_reflections += 1

			return num_reflections


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









"""simple docstring"""






from __future__ import annotations






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			if b == 0:
						return (1, 0)
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		Any			=extended_euclid(__lowerCamelCase							,		a % b	)
			lowerCamelCase__		:		Optional[Any]			=a // b
			return (y, x - k * y)






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		Any			=extended_euclid(__lowerCamelCase							,		__lowerCamelCase	)
			lowerCamelCase__		:		List[Any]			=na * na
			lowerCamelCase__		:		Union[str, Any]			=ra * x * na + ra * y * na
			return (n % m + m) % m






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		int			=extended_euclid(__lowerCamelCase							,		__lowerCamelCase	)
			if b < 0:
						lowerCamelCase__		:		Any			=(b % n + n) % n
			return b






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			lowerCamelCase__	,   lowerCamelCase__		:		Any			=invert_modulo(__lowerCamelCase							,		__lowerCamelCase	), invert_modulo(__lowerCamelCase							,		__lowerCamelCase	)
			lowerCamelCase__		:		Tuple			=na * na
			lowerCamelCase__		:		Optional[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)




