



"""simple docstring"""







from __future__ import annotations

import math
class        __A       :







		'''simple docstring'''





		def __init__(	self						:  Optional[int]			,_snake_case						:  int						)					->		None:






				"""simple docstring"""



				lowercase__   :    str				=			size
				# approximate the overall size of segment tree with given value
				lowercase__   :    Optional[Any]				=			[0 for i in range(0			,4 * size						)]
				# create array to store lazy update
				lowercase__   :    Optional[int]				=			[0 for i in range(0			,4 * size						)]
				lowercase__   :    Optional[Any]				=			[0 for i in range(0			,4 * size						)]  # flag for lazy update







		def 					UpperCAmelCase    (	self						:  Optional[int]			,_snake_case						:  int						)					->		int:






				"""simple docstring"""



				return idx * 2







		def 					UpperCAmelCase    (	self						:  Optional[int]			,_snake_case						:  int						)					->		int:






				"""simple docstring"""



				return idx * 2 + 1







		def 					UpperCAmelCase    (	self						:  List[Any]			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  list[int]						)					->		None:






				"""simple docstring"""



				if left_element == right_element:
						lowercase__   :    List[str]				=			a[left_element - 1]
				else:
						lowercase__   :    Dict				=			(left_element + right_element) // 2
						self.build(self.left(_snake_case						)			,_snake_case			,_snake_case			,_snake_case						)
						self.build(self.right(_snake_case						)			,mid + 1			,_snake_case			,_snake_case						)
						lowercase__   :    Tuple				=			max(
						    self.segment_tree[self.left(_snake_case						)]			,self.segment_tree[self.right(_snake_case						)]						)







		def 					UpperCAmelCase    (	self						:  Union[str, Any]			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int						)					->		bool:






				"""simple docstring"""



				if self.flag[idx] is True:
						lowercase__   :    Optional[int]				=			self.lazy[idx]
						lowercase__   :    Tuple				=			False
						if left_element != right_element:
								lowercase__   :    Any				=			self.lazy[idx]
								lowercase__   :    Union[str, Any]				=			self.lazy[idx]
								lowercase__   :    List[Any]				=			True
								lowercase__   :    Dict				=			True

				if right_element < a or left_element > b:
						return True
				if left_element >= a and right_element <= b:
						lowercase__   :    Tuple				=			val
						if left_element != right_element:
								lowercase__   :    Any				=			val
								lowercase__   :    int				=			val
								lowercase__   :    List[str]				=			True
								lowercase__   :    Optional[int]				=			True
						return True
				lowercase__   :    Tuple				=			(left_element + right_element) // 2
				self.update(self.left(_snake_case						)			,_snake_case			,_snake_case			,_snake_case			,_snake_case			,_snake_case						)
				self.update(self.right(_snake_case						)			,mid + 1			,_snake_case			,_snake_case			,_snake_case			,_snake_case						)
				lowercase__   :    int				=			max(
				    self.segment_tree[self.left(_snake_case						)]			,self.segment_tree[self.right(_snake_case						)]						)
				return True







		def 					UpperCAmelCase    (	self						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int						)					->		int | float:






				"""simple docstring"""



				if self.flag[idx] is True:
						lowercase__   :    int				=			self.lazy[idx]
						lowercase__   :    Optional[Any]				=			False
						if left_element != right_element:
								lowercase__   :    Optional[Any]				=			self.lazy[idx]
								lowercase__   :    List[Any]				=			self.lazy[idx]
								lowercase__   :    Any				=			True
								lowercase__   :    Any				=			True
				if right_element < a or left_element > b:
						return -math.inf
				if left_element >= a and right_element <= b:
						return self.segment_tree[idx]
				lowercase__   :    Optional[int]				=			(left_element + right_element) // 2
				lowercase__   :    str				=			self.query(self.left(_snake_case						)			,_snake_case			,_snake_case			,_snake_case			,_snake_case						)
				lowercase__   :    List[Any]				=			self.query(self.right(_snake_case						)			,mid + 1			,_snake_case			,_snake_case			,_snake_case						)
				return max(_snake_case			,_snake_case						)







		def __str__(	self						:  str						)					->		str:






				"""simple docstring"""



				return str([self.query(1			,1			,self.size			,_snake_case			,_snake_case						) for i in range(1			,self.size + 1						)]						)


if __name__ == "__main__":
							lowerCAmelCase_   						=   [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
							lowerCAmelCase_   						=   15
							lowerCAmelCase_   						=   SegmentTree(size)
							segt.build(1, 1, size, A)
							print(segt.query(1, 1, size, 4, 6))
							print(segt.query(1, 1, size, 7, 11))
							print(segt.query(1, 1, size, 7, 12))
							segt.update(1, 1, size, 1, 3, 111)
							print(segt.query(1, 1, size, 1, 15))
							segt.update(1, 1, size, 7, 8, 235)
							print(segt)




"""simple docstring"""




from math import isclose, sqrt


def     lowercase			(SCREAMING_SNAKE_CASE_		:				float ,			SCREAMING_SNAKE_CASE_		:				float ,			SCREAMING_SNAKE_CASE_		:				float  )   ->						tuple[float, float, float]:
						SCREAMING_SNAKE_CASE													=					point_y / 4 / point_x
						SCREAMING_SNAKE_CASE													=					2 * normal_gradient / (1 + normal_gradient * normal_gradient)
						SCREAMING_SNAKE_CASE													=					(1 - normal_gradient * normal_gradient) / (
						    1 + normal_gradient * normal_gradient
						)
						SCREAMING_SNAKE_CASE													=					(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
						SCREAMING_SNAKE_CASE													=					outgoing_gradient**2 + 4
						SCREAMING_SNAKE_CASE													=					2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
						SCREAMING_SNAKE_CASE													=					(point_y - outgoing_gradient * point_x) ** 2 - 1_00

						SCREAMING_SNAKE_CASE													=					(
						    -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term  )
						) / (2 * quadratic_term)
						SCREAMING_SNAKE_CASE													=					(
						    -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term  )
						) / (2 * quadratic_term)

						# two solutions, one of which is our input point
						SCREAMING_SNAKE_CASE													=					x_minus if isclose(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  ) else x_plus
						SCREAMING_SNAKE_CASE													=					point_y + outgoing_gradient * (next_x - point_x)

						return next_x, next_y, outgoing_gradient


def     lowercase			(SCREAMING_SNAKE_CASE_		:				float = 1.4 ,			SCREAMING_SNAKE_CASE_		:				float = -9.6  )   ->						int:
						SCREAMING_SNAKE_CASE													=					0
						SCREAMING_SNAKE_CASE													=					first_x_coord
						SCREAMING_SNAKE_CASE													=					first_y_coord
						SCREAMING_SNAKE_CASE													=					(10.1 - point_y) / (0.0 - point_x)

						while not (-0.01 <= point_x <= 0.01 and point_y > 0):
												SCREAMING_SNAKE_CASE							,				SCREAMING_SNAKE_CASE							,				SCREAMING_SNAKE_CASE													=					next_point(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )
												num_reflections += 1

						return num_reflections


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


