



import math

class 	__snake_case :







							'''simple docstring'''






							def __init__(							self					,					a_						):
											a__			 =						len(a_						)
											a__			 =						[0] * (
											    4 * self.N
											)  # approximate the overall size of segment tree with array N
											self.build(1					,					0					,					self.N - 1						)


							def _a (							self					,					a_						):
											return idx * 2


							def _a (							self					,					a_						):
											return idx * 2 + 1


							def _a (							self					,					a_					,					a_					,					a_						):  # noqa: E741
											if l == r:
															a__			 =						A[l]
											else:
															a__			 =						(l + r) // 2
															self.build(self.left(a_						)					,					a_					,					a_						)
															self.build(self.right(a_						)					,					mid + 1					,					a_						)
															a__			 =						max(self.st[self.left(a_						)]					,					self.st[self.right(a_						)]						)


							def _a (							self					,					a_					,					a_					,					a_						):
											return self.update_recursive(1					,					0					,					self.N - 1					,					a - 1					,					b - 1					,					a_						)


							def _a (							self					,					a_					,					a_					,					a_					,					a_					,					a_					,					a_						):  # noqa: E741
											if r < a or l > b:
															return True
											if l == r:
															a__			 =						val
															return True
											a__			 =						(l + r) // 2
											self.update_recursive(self.left(a_						)					,					a_					,					a_					,					a_					,					a_					,					a_						)
											self.update_recursive(self.right(a_						)					,					mid + 1					,					a_					,					a_					,					a_					,					a_						)
											a__			 =						max(self.st[self.left(a_						)]					,					self.st[self.right(a_						)]						)
											return True


							def _a (							self					,					a_					,					a_						):
											return self.query_recursive(1					,					0					,					self.N - 1					,					a - 1					,					b - 1						)


							def _a (							self					,					a_					,					a_					,					a_					,					a_					,					a_						):  # noqa: E741
											if r < a or l > b:
															return -math.inf
											if l >= a and r <= b:
															return self.st[idx]
											a__			 =						(l + r) // 2
											a__			 =						self.query_recursive(self.left(a_						)					,					a_					,					a_					,					a_					,					a_						)
											a__			 =						self.query_recursive(self.right(a_						)					,					mid + 1					,					a_					,					a_					,					a_						)
											return max(a_					,					a_						)







							def _a (							self						):
											a__			 =						[]
											for i in range(1					,					N + 1						):
															show_list += [self.query(a_					,					a_						)]
											print(a_						)


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






def      A_ (		__a       :			int = 1_000						):

				"""simple docstring"""
				return sum(i for i in range(__a						) if i % 3 == 0 or i % 5 == 0						)


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

